row, col = map(int, input().split())
arr = list(map(int,input().split()))
newarr = [[] for i in range(row)]
for i in range(row):
for j in range(col*i,col*(i+1)):
newarr[i].append(arr[j])
for i in newarr:
print(*i)
n,m =map(int,input().split())
a = list(map(int, input().split()))
for i in range(n):
list_start=i*m
list_end=list_start+m
print(*a[list_start:list_end])
n, m = map(int, input().split())
a = list(input().split())
# count = 0
for i in range(n):
for j in range(m):
# print(a[count], end=' ')
# count += 1
print(a[i*m+j], end=' ')
print()