from collections import deque n = int(input()) d = deque(list(range(1, n + 1))) for _ in range(n): d.rotate(1) print(*d)