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

N = int(eval(input()))

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

A.insert(0,0)

B = [[0 for _ in range(W)] for _ in range(H)]

col = 1

cnt = 0

y = 0

x = 0

d = "R"

while y<H:

    if cnt<A[col]:

        B[y][x] = col

        cnt += 1

    else:

        col += 1

        cnt = 0

        B[y][x] = col

        cnt += 1

    if x<W-1 and d=="R":

        x += 1

    elif x==W-1 and d=="R":

        y += 1

        d = "L"

    elif d=="L" and x>0:

        x -= 1

    elif d=="L" and x==0:

        y += 1

        d = "R"

for i in range(H):

    print((*B[i]))
H,W = list(map(int,input().split()))

N = int(eval(input()))

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

A.insert(0,0)

B = [[0 for _ in range(W)] for _ in range(H)]



col = 1

cnt = 0

i = 0

j = 0

d = 1

while True:

    if cnt<A[col]:

        B[i][j] = col

        cnt += 1

    else:

        col += 1

        cnt = 0

        B[i][j] = col

        cnt += 1

    if d==1 and j<W-1:

        j += 1

    elif d==1 and j==W-1:

        i += 1

        d = -1

    elif d==-1 and j>0:

        j -= 1

    elif d==-1 and j==0:

        i += 1

        d = 1

    if i>=H:break

for i in range(H):

    print((*B[i]))
H, W = list(map(int, input().split()))
N = int(eval(input()))
A = list(map(int, input().split()))
A.insert(0, 0)
B = [[0 for _ in range(W)] for _ in range(H)]
col = 1
cnt = 0
y = 0
x = 0
d = "R"
while y < H:
    if cnt < A[col]:
        B[y][x] = col
        cnt += 1
    else:
        col += 1
        cnt = 0
        B[y][x] = col
        cnt += 1
    if x < W - 1 and d == "R":
        x += 1
    elif x == W - 1 and d == "R":
        y += 1
        d = "L"
    elif d == "L" and x > 0:
        x -= 1
    elif d == "L" and x == 0:
        y += 1
        d = "R"
for i in range(H):
    print((*B[i]))

H, W = list(map(int, input().split()))
N = int(eval(input()))
A = list(map(int, input().split()))
A.insert(0, 0)
B = [[0 for _ in range(W)] for _ in range(H)]
col = 1
cnt = 0
i = 0
j = 0
d = 1
while True:
    if cnt < A[col]:
        B[i][j] = col
        cnt += 1
    else:
        col += 1
        cnt = 0
        B[i][j] = col
        cnt += 1
    if d == 1 and j < W - 1:
        j += 1
    elif d == 1 and j == W - 1:
        i += 1
        d = -1
    elif d == -1 and j > 0:
        j -= 1
    elif d == -1 and j == 0:
        i += 1
        d = 1
    if i >= H:
        break
for i in range(H):
    print((*B[i]))

-y = 0 -x = 0 -d = "R" -while y < H: +i = 0 +j = 0 +d = 1 +while True: -        B[y][x] = col +        B[i][j] = col -        B[y][x] = col +        B[i][j] = col -    if x < W - 1 and d == "R": -        x += 1 -    elif x == W - 1 and d == "R": -        y += 1 -        d = "L" -    elif d == "L" and x > 0: -        x -= 1 -    elif d == "L" and x == 0: -        y += 1 -        d = "R" +    if d == 1 and j < W - 1: +        j += 1 +    elif d == 1 and j == W - 1: +        i += 1 +        d = -1 +    elif d == -1 and j > 0: +        j -= 1 +    elif d == -1 and j == 0: +        i += 1 +        d = 1 +    if i >= H: +        break