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

N = int(eval(input()))

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

A.insert(0,0)

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

cur = [0,0,"R"]

for k in range(1,N+1):

#     ipdb.set_trace()

    a = A[k]

    cnt = 0

    y,x,d = cur

    for i in range(y,H):

        y = i

        if d=="R":

            for j in range(x,W):

                C[i][j]=str(k)

                cnt += 1

                if j+1<W:

                    x = j+1

                else:

                    x = j

                if cnt==a:break

            if cnt==a:break

            d="L"

        else:

            for j in range(x,-1,-1):

                C[i][j]=str(k)

                cnt += 1

                if j>=1:

                    x = j-1

                else:

                    x = 0

                if cnt==a:break

            if cnt==a:break

            d="R"

    if x==W-1:

        if C[y][x]!=0:

            y += 1

            d="L"

    elif x==0:

        if C[y][x]!=0:

            y += 1

            d="R"

    cur = [y,x,d]                

for i in range(H):

    print((*C[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)
C = [[0 for _ in range(W)] for _ in range(H)]
cur = [0, 0, "R"]
for k in range(1, N + 1):
    #     ipdb.set_trace()
    a = A[k]
    cnt = 0
    y, x, d = cur
    for i in range(y, H):
        y = i
        if d == "R":
            for j in range(x, W):
                C[i][j] = str(k)
                cnt += 1
                if j + 1 < W:
                    x = j + 1
                else:
                    x = j
                if cnt == a:
                    break
            if cnt == a:
                break
            d = "L"
        else:
            for j in range(x, -1, -1):
                C[i][j] = str(k)
                cnt += 1
                if j >= 1:
                    x = j - 1
                else:
                    x = 0
                if cnt == a:
                    break
            if cnt == a:
                break
            d = "R"
    if x == W - 1:
        if C[y][x] != 0:
            y += 1
            d = "L"
    elif x == 0:
        if C[y][x] != 0:
            y += 1
            d = "R"
    cur = [y, x, d]
for i in range(H):
    print((*C[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]))

-C = [[0 for _ in range(W)] for _ in range(H)] -cur = [0, 0, "R"] -for k in range(1, N + 1): -    #     ipdb.set_trace() -    a = A[k] -    cnt = 0 -    y, x, d = cur -    for i in range(y, H): -        y = i -        if d == "R": -            for j in range(x, W): -                C[i][j] = str(k) -                cnt += 1 -                if j + 1 < W: -                    x = j + 1 -                else: -                    x = j -                if cnt == a: -                    break -            if cnt == a: -                break -            d = "L" -        else: -            for j in range(x, -1, -1): -                C[i][j] = str(k) -                cnt += 1 -                if j >= 1: -                    x = j - 1 -                else: -                    x = 0 -                if cnt == a: -                    break -            if cnt == a: -                break -            d = "R" -    if x == W - 1: -        if C[y][x] != 0: -            y += 1 -            d = "L" -    elif x == 0: -        if C[y][x] != 0: -            y += 1 -            d = "R" -    cur = [y, x, d] +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" -    print((*C[i])) +    print((*B[i]))