N = int(input()) for i in range(1, N + 1): for j in range(1, N + 1): v = (2 * i - j) % N print(v if v else N, end=" ") print()