N=int(input()) result=[[0]*N for i in range(N)] c=0 x=0 y=0 t=0 count=0 while True: if c==N**2: break if t==0: if x==y or x==N-1-y: c+=1 result[x][y]=c if c==N**2: break c+=1 a,b=N-1-x,N-1-y result[a][b]=c c+=1 a,b=x,N-1-y result[a][b]=c c+=1 a,b=N-1-x,y result[a][b]=c t=1 x,y=N-1-x,y if count%2==0: y+=1 else: y-=1 else: c+=1 result[x][y]=c c+=1 result[y][x]=c c+=1 result[y][N-1-x]=c c+=1 result[N-1-x][y]=c x,y=N-1-x,y t=1 if count%2==0: if result[x][y+1]>0: count+=1 x-=1 else: y+=1 else: if result[x][y-1]>0: count+=1 x-=1 else: y-=1 else: if x==y or x==N-1-y: c+=1 result[x][y]=c if c==N**2: break c+=1 a,b=N-1-x,N-1-y result[a][b]=c c+=1 a,b=x,N-1-y result[a][b]=c c+=1 a,b=N-1-x,y result[a][b]=c t=0 x,y=N-1-x,y if count%2==0: y+=1 else: y-=1 else: c+=1 result[x][y]=c c+=1 result[y][x]=c c+=1 result[y][N-1-x]=c c+=1 result[N-1-x][y]=c x,y=N-1-x,y t=0 if count%2==0: if result[x][y+1]>0: count+=1 x+=1 else: y+=1 else: if result[x][y-1]>0: count+=1 x+=1 else: y-=1 for i in range(N): print(*result[i])