# n = int(input())
# v = list(map(int, input().split()))
# for i in range(n*2):
# print(v[i%n])
# n = int(input())
# for i in range(0, n): #가로
# for j in range(1, n+1): #세로
# print(n*i+j, end=' ')
# print()
# n = int(input())
# for i in range(1, n): #줄이 몇개 생기게 하는지 조정
# for j in range(0, n+1): #줄에서 포함된 개수 조정
# print(n*i-j, end=' ')
# print()
# n = int(input())
#
# data = []
#
# for i in range(n):
# v = [0] * n
# data.append(v)
#
# k = 1
#
# for i in range(n):
# for j in range(n):
# data[j][i] = k
# k += 1
#
# for i in range(n-1, -1, -1):
# for j in range(n):
# print(data[i][j], end=' ')
# print()
#
# n, m = map(int, input().split())
#
# data = []
#
# for i in range(n):
# v = [0] * m
# data.append(v)
#
# k = 1
#
# for i in range(n):
# for j in range(m):
# data[i][j] = k
# k += 1
#
# for i in range(n-1, -1, -1):
# for j in range(m-1, -1, -1):
# print(data[i][j], end=' ')
# print()
# n, m = map(int, input().split())
#
# data = []
#
# for i in range(n):
# v = [0] * m
# data.append(v)
#
# k = 1
#
# for i in range(n):
# for j in range(m):
# data[i][j] = k
# k += 1
#
# for i in range(n-1, -1, -1):
# for j in range(m):
# print(data[i][j], end=' ')
# print()
# n, m = map(int, input().split())
#
# data = []
#
# for i in range(n):
# v = [0] * m
# data.append(v)
#
# k = 1
#
# for i in range(m):
# for j in range(n):
# data[j][i] = k
# k += 1
#
# for i in range(n-1, -1, -1):
# for j in range(m-1, -1, -1):
# print(data[i][j], end=' ')
# print()
# n, m = map(int, input().split())
#
# data = []
#
# for i in range(n):
# v = [0] * m
# data.append(v)
#
# k = 1
#
# for i in range(m):
# for j in range(n):
# data[j][i] = k
# k += 1
#
# for i in range(n):
# for j in range(m-1, -1, -1):
# print(data[i][j], end=' ')
# print()