N = int(input()) cnt = 1 for i in range(N): line = [] for j in range(i + 1, i + 1 + N): if j > N: j -= N line.append(j) print(*line)