H,W=map(int,input().split())

N=int(input())

A=list(map(int,input().split()))

k=1

L=[]

for i in range(N):

	for j in range(A[i]):

		L.append(k)

	k=k+1

k=0

c=1

for j in range(H):

	if c==-1:

		tmp=L[k:k+W]

		ans=tmp[::-1]

	else:

		ans=L[k:k+W]

	for i in ans:

		print(i,end=" ")

	print()

	k+=W

	c=-1*c

H,W=list(map(int,input().split()))

N=int(eval(input()))

L=list(map(int,input().split()))

ans=[]

for i in range(N):

	for j in range(L[i]):

		ans.append((i+1))

for i in range(H):

	if i%2==0:

		print((*ans[i*W:(i+1)*W]))

	elif i%2==1:

		tmp=ans[i*W:(i+1)*W]

		print((*tmp[::-1]))
H, W = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))
k = 1
L = []
for i in range(N):
    for j in range(A[i]):
        L.append(k)
    k = k + 1
k = 0
c = 1
for j in range(H):
    if c == -1:
        tmp = L[k : k + W]
        ans = tmp[::-1]
    else:
        ans = L[k : k + W]
    for i in ans:
        print(i, end=" ")
    print()
    k += W
    c = -1 * c

H, W = list(map(int, input().split()))
N = int(eval(input()))
L = list(map(int, input().split()))
ans = []
for i in range(N):
    for j in range(L[i]):
        ans.append((i + 1))
for i in range(H):
    if i % 2 == 0:
        print((*ans[i * W : (i + 1) * W]))
    elif i % 2 == 1:
        tmp = ans[i * W : (i + 1) * W]
        print((*tmp[::-1]))

-H, W = map(int, input().split()) -N = int(input()) -A = list(map(int, input().split())) -k = 1 -L = [] +H, W = list(map(int, input().split())) +N = int(eval(input())) +L = list(map(int, input().split())) +ans = [] -    for j in range(A[i]): -        L.append(k) -    k = k + 1 -k = 0 -c = 1 -for j in range(H): -    if c == -1: -        tmp = L[k : k + W] -        ans = tmp[::-1] -    else: -        ans = L[k : k + W] -    for i in ans: -        print(i, end=" ") -    print() -    k += W -    c = -1 * c +    for j in range(L[i]): +        ans.append((i + 1)) +for i in range(H): +    if i % 2 == 0: +        print((*ans[i * W : (i + 1) * W])) +    elif i % 2 == 1: +        tmp = ans[i * W : (i + 1) * W] +        print((*tmp[::-1]))