93.4% (57/61)

36.8% (89/242)

# Description

Magic square is an $n$ by $n$ square grid where each cell of the grid contains distinct integers in the range
$1, 2, \cdots, n^ 2$ , and the sum of each row, column and diagonal is equal.
To create an $n$ by $n$ magic square($n$ is odd), you have to fill in $1, 2, \cdots, n^ 2$ accordingly with the following steps:

1. Put $1$ in the middle of the first row.
2. If upper-right cell is empty, move to the upper-right cell, move downward otherwise. And if it is out of the boundary, jump to opposite of the square grid.
3. Fill in the next integer.
4. If still haven’t reach $n^ 2$ yet, go to step 2.

# Input Format

A positive odd integer $n(n\leq1001)$

# Output Format

An $n\times n$ magic square which is generated by the previous steps. Notice that integers in the same row are separated by a single white space, and each row should end with a new line character(‘\n’).

3

8 1 6
3 5 7
4 9 2