N = int(input()) for i in range(N): yoko = [0]*N for j in range(N): yoko[j] = (2*(i+1)-(j+1))%N if yoko[j] == 0: yoko[j] = N print(*yoko)