N = int(input()) temp = [1] + list(range(N,1,-1)) for i in range(N): print(*temp) temp = temp[N-2:N] + temp[:N-2]