from collections import deque n=int(input()) a=deque() for i in range(n,0,-1): a.append(i) for i in range(n): print(*a) a.appendleft(a.pop())