Problem B. Matrix detour: Spiral

Author:A. Klenin   Time limit:2 sec
Input file:input.txt   Memory limit:200 Mb
Output file:output.txt  

Statement

Your program must fill the N by N square matrix with integers from 1 to N2; in the following way:

Input file format

Input file contains an integer N.

Output file format

Output file must contain the filled matrix as N lines consisting of N integers each.

Constraints

1 <= N <= 100

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
2
1 2
4 3
2
3
1 2 3
8 9 4
7 6 5

0.063s 0.007s 13