1005 做幻方


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 4M

Problem types
Allowed languages
C, C++, Java, Python

Description

Apple最近迷上了做幻方,Apple还是个中高手,只要你说个奇数N,他就能把N*N的幻方做出来。其实你可以比他做得更好的。Apple总是画得很乱,而你可以利用程序排得很整齐^_^ 幻方的要求:每一行,每一列,还有两条斜线上数字的和都相等。

Input

每行有一个数N(0< N < 30),输入0结束。

Output

输入一个奇数,输出一个幻方,每个数占3格,顺序参照样板输出,输出完以后加一个回车。

Sample

Input

5
1
0

Output

11 18 25  2  9
 10 12 19 21  3
  4  6 13 20 22
 23  5  7 14 16
 17 24  1  8 15

  1

Hint

如果不会做幻方的请从1开始数到最后,相信你会发现其中的规律。当然输出也要按照这样的格式。


Source: Zhang Anping


Comments

There are no comments at the moment.