from collections import deque from sys import stdin def main(): input = lambda: stdin.readline()[:-1] N = int(input()) a = deque(range(N, 0, -1)) a.rotate() for _ in [0] * N: print(*a) a.rotate(2) main()