#bzoj2214. Shift

Shift

Title Description

Byteasar\text{Byteasar} bought his son Bytie\text{Bytie} a set of blocks numbered from to and arranged them in a row in a certain order. Bytie\text{Bytie}'s goal is to rearrange the blocks so that they are ordered naturally, from the smallest number to the largest. However, the only moves Bytie\text{Bytie} is allowed to make are: putting the last block at the very beginning (move aa), and putting the third block at the very beginning (move bb). Help Bytie\text{Bytie} by writing a program that tells whether a given arrangement of blocks can be properly reordered, and tells the right sequence of moves if it is.

Input format

In the first line of the standard input there is a single integer NN. In the second line there are integers from the range to , separated by single spaces. No number appears twice, and thus they represent the initial arrangement of the blocks. .

Output format

tmp.png

Sample

4 
1 3 2 4
4 
3a 2b 2a 2b
7 
1 3 2 4 5 6 7
NIE DA SIE
3 
1 2 3
0

Data scope and agreement

For 100%100\% of the data:1N2000,mN21\le N\le 2000,m\le N^2.