k=int n=k(input()) l=[i for i in range(1,n*n+1)] d=[1,n,-1,-n] p=1 q=n-1 c=n+1 m=n-0.5 while k(m): for i in [0]*k(m):l[q+d[p]]=c;c+=1;q+=d[p] p=(p+1)%4 m-=0.5 for i in range(n): for j in range(n): print("%03d"%l[i*n+j],end="") if j!=n-1:print(" ",end="") print()