n = int(input()) lst = [] s = 1 l = (n+1)//2+1 for i in range(n): if i%2 == 0: lst.append(s) s += 1 else: lst.append(l) l += 1 a = [lst[i:] + lst[:i] for i in range(n)] for i in range(n): print(*a[i])