h,w=list(map(int,input().split()))

n=int(eval(input()))

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

ret=[["0" for i in range(w)]for j in range(h)]

x=0

y=0

for i in range(n):

    for j in range(a[i]):

        ret[y][x]=str(i+1)

        if y&1:

            if x==0:

                y+=1

            else:

                x-=1

        else:

            if x==w-1:

                y+=1

            else:

                x+=1

for i in range(h):

    print((" ".join(ret[i])))


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

N = int(eval(input()))

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



ans = []



current_a=a[0]

current_id = 1

for i in range(H):

    w_ans = []

    for j in range(W):

        if current_a == 0:

            current_a = a[current_id]

            current_id += 1

        

        current_a -= 1

        w_ans.append(str(current_id))

    if i%2==1:

        w_ans = w_ans[::-1]

    ans.append(w_ans)



for i in range(H):

    print((" ".join(ans[i])))

h, w = list(map(int, input().split()))
n = int(eval(input()))
a = list(map(int, input().split()))
ret = [["0" for i in range(w)] for j in range(h)]
x = 0
y = 0
for i in range(n):
    for j in range(a[i]):
        ret[y][x] = str(i + 1)
        if y & 1:
            if x == 0:
                y += 1
            else:
                x -= 1
        else:
            if x == w - 1:
                y += 1
            else:
                x += 1
for i in range(h):
    print((" ".join(ret[i])))

H, W = list(map(int, input().split()))
N = int(eval(input()))
a = list(map(int, input().split()))
ans = []
current_a = a[0]
current_id = 1
for i in range(H):
    w_ans = []
    for j in range(W):
        if current_a == 0:
            current_a = a[current_id]
            current_id += 1
        current_a -= 1
        w_ans.append(str(current_id))
    if i % 2 == 1:
        w_ans = w_ans[::-1]
    ans.append(w_ans)
for i in range(H):
    print((" ".join(ans[i])))

-h, w = list(map(int, input().split())) -n = int(eval(input())) +H, W = list(map(int, input().split())) +N = int(eval(input())) -ret = [["0" for i in range(w)] for j in range(h)] -x = 0 -y = 0 -for i in range(n): -    for j in range(a[i]): -        ret[y][x] = str(i + 1) -        if y & 1: -            if x == 0: -                y += 1 -            else: -                x -= 1 -        else: -            if x == w - 1: -                y += 1 -            else: -                x += 1 -for i in range(h): -    print((" ".join(ret[i]))) +ans = [] +current_a = a[0] +current_id = 1 +for i in range(H): +    w_ans = [] +    for j in range(W): +        if current_a == 0: +            current_a = a[current_id] +            current_id += 1 +        current_a -= 1 +        w_ans.append(str(current_id)) +    if i % 2 == 1: +        w_ans = w_ans[::-1] +    ans.append(w_ans) +for i in range(H): +    print((" ".join(ans[i])))