# coding: utf-8 # Your code here! N=int(input()) A=[i+1 for i in range(N)] for _ in range(N): print(*A) A=A[1:]+A[:1]