n = int(input()) for i in range(n): num = i * 2 + 1 num = (num - 1) % n + 1 for _ in range(n): print(num, end=" ") num -= 1 if num == 0: num = n print()