n=int(input()) l=[[0 for i in range(n)] for j in range(n)] for d in range(n): r=d+1 l[d][d]=r i,j=d,d for k in range(n-1): i=(i+1)%n j=(j-1)%n l[i][j]=r for i in l: print(*i)