import sys readline = sys.stdin.readline readall = sys.stdin.read ns = lambda: readline().rstrip() ni = lambda: int(readline().rstrip()) nm = lambda: map(int, readline().split()) nl = lambda: list(map(int, readline().split())) prn = lambda x: print(*x, sep='\n') def solve(): n = ni() a = [i//2 + 2 + n//2 if i%2 else i//2 + 1 for i in range(n)] for i in range(n): print(*(a[i:] + a[:i])) return solve()