Preparando MOJI
You've got an n × n × n cube, split into unit cubes. Your task is to number all unit cubes in this cube with positive integers from 1 to n3 so that:
Find and print the required numeration of unit cubes of the cube.
The first line contains a single integer n (1 ≤ n ≤ 50) — the size of the cube, whose unit cubes need to be numbered.
Print all layers of the cube as n n × n matrices. Separate them with new lines. Print the layers in the order in which they follow in the cube. See the samples for clarifications.
It is guaranteed that there always is a solution that meets the conditions given in the problem statement.
3
1 4 17
2 3 18
27 26 19
8 5 16
7 6 15
24 25 20
9 12 13
10 11 14
23 22 21
In the sample the cubes with sizes 2 × 2 × 2 are numbered with integers 1, ..., 8 and 5, ..., 12.