n=int(input()) l=[i for i in range(1,n+1)] print(*l) for _ in range(n-1): tmp=[] for i in l[1:]: tmp.append(i) tmp.append(l[0]) print(*tmp) l=tmp