# #2158. 「POI2011 R1」移方块 Shift

#### 题目描述

Byteasar bought his son Bytie a set of blocks numbered from $1$ to $n$ and arranged them in a row in a certain order. 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 is allowed to make are:

• putting the last block at the very beginning (move a), and
• putting the third block at the very beginning (move b).

Help 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.

Byteasar 给他的儿子 Bytie 买了一盒共 $n$ 块积木，他将这些积木从 $1$$n$ 编号，并按照一定的顺序摆成一排。Bytie 要将这些积木按照编号从小到大的顺序重新排列，但他只能做下面两种操作：

• 操作 a：将最后一个积木移到最前面。
• 操作 b：把第三个积木移到最前面。

#### 输入格式

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

#### 输出格式

If there is no sequence of moves leading to an arrangement with increasing blocks' numbers, your program should print out "NIE DA SIE" (there is no way in Polish), without the quotation marks.

Otherwise there should be a single integer $m$($m \le n^2$), denoting the number of operations, in the first line. An operation is a $k$-fold execution of either a or b move.

If $m \gt 0$, then there should be a sequence of $m$ integers with either a or b appended in the second line. Thus $k a$(for $0 \lt k \lt n$) denotes the $k$-fold execution of the move a. Analogously, $k b$(for $0 \lt k \lt n$) denotes the $k$-fold execution of the move b.

Furthermore, the characters appended to the numbers in the second line have to alternate.

Should there be more than one solution, your program is free to pick one arbitrarily.

#### For the input data:输入样例1

4
1 3 2 4

#### the correct result is:输出样例1

4
3a 2b 2a 2b

#### whereas for the input data: 输入样例2

7
1 3 2 4 5 6 7

#### the correct output is: 输出样例2

NIE DA SIE

#### and for the input data: 输入样例3

3
1 2 3

#### the correct output is: 输出样例3

0

#### 数据范围与提示

Task authors: Krzysztof Diks & Wojciech Rytter.