Page not loading? Try clicking here.
Placeholder

#1304

Number Rectangle 3 1s 32MB

Problems

After receiving the side length n of a square,
write a program that prints a square shape made of numbers as shown below.

[When n = 5]

[Processing Conditions]

The order of the numbers proceeds as follows:
first, start from the top left and move downward for n steps,
then immediately move to the position at the top of the next column to the right and again proceed downward.
Repeat this method until the shape becomes a square.


Input

Receive the side length n of the square (n is a natural number not exceeding 100).


Output

Print the number square with side length n in the format described above.
Separate the numbers with spaces.


Example

4
1 5 9 13

2 6 10 14
3 7 11 15
4 8 12 16


Source

JUNGOL

You must sign in to write code.