a = int(input())
list = [[i+j*a+1 for i in range(a)] for j in range(a)]
for i in range(a) :
for j in range(a) :
print(list[i][j],end=' ')
print()
list = [[i+j*a+1 for i in range(a-1,-1,-1)] for j in range(a)]
for i in range(a) :
for j in range(a) :
print(list[i][j],end=' ')
print()