n = int(input()) ans = [[0]*n for i in range(n)] for i in range(n): for j in range(n): x = 2*(i+1)-(j+1) if x%n != 0: ans[i][j] = x%n else: ans[i][j] = n for i in range(n): print(*ans[i])