mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline # Nは奇数!!!! N = int(input()) A = [[0] * N for _ in range(N)] cols = [0] * (N+1) for i in range(N): for val in range(1, N+1): A[i][(val - 1 + i)%N] = val if i+1 == val: cols[val] = (val - 1 + i)%N ans = [[0] * N for _ in range(N)] for val in range(1, N+1): j = cols[val] for i in range(N): ans[i][val-1] = A[i][j] for i in range(N): print(*ans[i]) if __name__ == '__main__': main()