n, m = int(input()), int(input())
matrix = []
i = 0
for line in range(0, m):
matrix.append([])
for item in range(0, n):
i += 1
if i > m * n:
break
matrix[line].append(i)
print(matrix)
n, m = int(input()), int(input())
matrix = []
i = 0
for line in range(0, m):
matrix.append([])
for item in range(0, n):
i += 1
if i > m * n:
break
matrix[line].append(i)
print(matrix)