Knight jumps

Given a board with three columns and nn rows, find a way for a chess knight to visit exactly 3n23n - 2 cells, starting at any cell, and never repeating any cell nor going outside the board.

Input

Input consists of several cases, each with an nn between 3 and 10510^5.

Output

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 nn. Follow strictly the format of the sample output.

Problem information

Author: Xavier Povill

Generation: 2026-01-25T12:18:39.239Z

© Jutge.org, 2006–2026.
https://jutge.org