|Author:||A. Klenin||Time limit:||1 sec|
|Input file:||input.txt||Memory limit:||256 Mb|
During the course on compiler construction, students were assigned a task: implement a parser for expressions with array access according to Pascal programming language syntax. Student Vasya has slacked on this task, and implemented only a very small language subset, consisting of a single integer constant 0 and accesses to a single two-dimensional array a. In other words, his "language" has the following grammar:
expr ::= 0 | a[expr,expr]
After seeing this sad result, a teacher assigned an additional task to Vasya: suppose an array a is defined as a: array [0..N - 1, 0..N - 1] of 0..N. Given N and the values of array elements, generate the shortest possible expression in Vasya's language which will have the value of N.
Input file contains an integer N, followed by N2 integers — values aij, in row-by-row order.
Output file must contain a single string — an expression in Vasya's language. The expression must exactly correspond to the grammar above. If there is no expression with the value of N, output string IMPOSSIBLE. If there are several shortest expressions, output any of them.
1 ≤ N ≤ 22, 0 ≤ aij ≤ N
|No.||Input file (
||Output file (|