A 1×4N grid has blocks in the rightmost 2N cells.
You may pick two consecutive occupied cells and move them to two consecutive empty cells. Block order must be preserved, and the destination must also be two consecutive cells.
Move the blocks the minimum number of times so that N consecutive 'A' blocks and N consecutive 'B' blocks are formed. There are 9 valid final arrangements.
One line with N (3≤N≤100).
Print moves in the form X to Y, meaning the blocks at cells X and X+1 move to cells Y and Y+1 (−2N+1≤X,Y≤2N−1, X=Y). Any optimal answer is accepted.