n = int(input())
if n % 2 == 0:
n1 = int(n/2)
n2 = n-n1
else:
n1 = int(n/2)+1
n2 = n-n1
x = 1
i = 1
i1 = 1
#Upper pattern
while i <= n1:
for j in range(1, n+1):
print(x, end=" ")
x = x+1
print()
if i == n1:
break
x = x+n
i = i+1
#Lowe Pattern
if n % 2 == 0:
while i1 <= n2:
for k in range(1, n+1):
print(x, end=" ")
x = x+1
x=x-(2*n)
print()
i1 = i1+1
x = x-n
y=y+1
else:
while i1 <= n2:
x = x-(2*n)
for k in range(1, n+1):
print(x, end=" ")
x = x+1
x=x-n
print()
i1 = i1+1