n = int(input())
a = [[0]*(n) for i in range(n)]
value = 1
x,y = 0,0
a[x][y] = value
while value < n*n:
while y+1 < n and a[x][y+1] == 0:#往右走
y += 1
value += 1
a[x][y] = value
while x+1 < n and a[x+1][y] == 0: # 往下
x += 1
value += 1
a[x][y] = value
while 0 <= y -1 and a[x][y-1] == 0:#往左走
y -= 1
value += 1
a[x][y] = value
while 0 <= x - 1 and a[x-1][y] == 0:#往上走
x -= 1
value += 1
a[x][y] = value
for i in range(n):
for j in range(n):
print(f"{a[i][j]:3d}",end=" ")
print()