Given a board with three columns and rows, find a way for a chess knight to visit exactly cells, starting at any cell, and never repeating any cell nor going outside the board.
Input consists of several cases, each with an between 3 and .
Print one line for each case, with any solution. Columns are labelled
with ‘a’, ‘b’ and ‘c’ in this
order, while rows are numbered from 1 to
.
Follow strictly the format of the sample output.
Input
5 3
Output
c5->a4->c3->b1->a3->c4->a5->b3->c1->a2->b4->c2->a1 a1->c2->a3->b1->c3->a2->c1