N=int(input()) L=[[0 for i in range(N)]for j in range(N)] L[0][0]=1 for i in range(1,N): L[0][i]=(L[0][i-1]+2)%N if L[0][i]==0: L[0][i]=N #print(L) for i in range(1,N): for j in range(N): L[i][j]=(L[i-1][j]+N-1)%N if L[i][j]==0: L[i][j]=N #print(L) for i in range(N): print(*L[i])