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