n=int(input())
s=n
if n==1:
print(n)
else:
total=n**2+1
num=1
m=[]
while n>=2:
a=[i for i in range(num,total)]
x1=[a[i:i+n] for i in range(0,4*n-4,2*n-2)] #n=3,num=17
x2=[a[i:i+n-2] for i in range(n,4*n-4,2*n-2)]
xx=[[] for i in range(n)]
xx[0]=x1[0]
xx[-1]=x1[-1][::-1]
for i in range(1,n-1):
xx[i]=[x2[1][n-2-i],*[i for i in '*'*(n-2)],x2[0][i-1]] #输出每一圈的回型
if n%2!=0 and (n-2)==1:
xx[int(n/2)][int(n/2)]=total-1
m.append(xx) 存储所有圈的回型
num+=4*(n-1)
n=n-2
for j in range(1,len(m)): #以最外圈为基准进行嵌套
for i in range(s-2*j):
m[0][i+j][j:s-j]=m[j][i]
for i in m[0]:
print(*i)