CF198D Cube Snake
Description
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 $ n^{3} $ so that:
- each number was used as a cube's number exactly once;
- for each $ 1
Input Format
The first line contains a single integer $ n $ ( $ 1
Output Format
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.
Explanation/Hint
In the sample the cubes with sizes $ 2×2×2 $ are numbered with integers $ 1,...,8 $ and $ 5,...,12 $ .