N = int(input()) ans = '' L = [0]*N for i in range(N): L[(i*2)%N] = str(i+1) for i in range(N): ans += ' '.join(L[i:]+L[:i]) + '\n' print(ans[:-1])