Mr. Chichikov is a wealthy man. Besides other ways of earning the money he used this one: he argued with some blunderers that he would be able to prove that it is impossible to pave the 512 × 512 square checker-board with the figures:
and he always won. Once one of those blunderers happened to be not so silly and he claimed that he was able to pave the 512 × 512 square checker-board without the upper right cell with those figures. Chichikov blurted out that he could pave any 2n × 2n square checker-board without one arbitrary cell with those figures. One word led to another and they bet. Chchikov felt that he wouldn’t prove his case. Help him!
Input
The first input line contains an integer n (1 ≤ n ≤ 9). The second line consists of two integers x and y — those are the coordinates of the deleted cell (1 ≤ x, y ≤ 2n). x is a number of a row and y is a number of a column. The coordinates of the upper left cell of the board are (1, 1).
Output
Your program is to output 2n lines with 2n numbers in each line. There must be 0 on the place of the deleted cell. On the other places there must be numbers from 1 to (22n − 1) / 3 — a number of figure that covers this cell. It is clear that equal numbers must form a figure. If such a coverage is impossible, output “−1”.
Sample
input | output |
---|
2
1 1
| 0 1 3 3
1 1 4 3
2 4 4 5
2 2 5 5
|
Problem Author: Alex Samsonov
Problem Source: The 12th High School Pupils Collegiate Programming Contest of the Sverdlovsk Region (October 15, 2005)