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