N=int(input()) a=[[0]*N for _ in range(N)] for i in range(N): for j in range(N): a[(i+j)%N][(i-j)%N]=i+1 for i in range(N): print(*a[i])