Serhiy was playing Snake and was close to catching the train to LKSH. However, he was unaware that an extra "bonus" level awaited him after the final stage.
This level features an N \times N grid, with an apple placed in each cell. Serhiy's snake moves along the diagonals of this grid, consuming the apples as it goes. After completing each diagonal, the snake changes its direction of movement (refer to examples for further clarification).
The input consists of a single integer (1 \le N \le 100).
Produce exactly rows, each containing numbers. These numbers represent the order in which the snake visits each cell in the grid.
Example 1
Example 3