a,b= map(int,input().split(" "))

c = int(input())

ar = list(map(int,input().split(" ")))

br = [[0 for i in range(b)] for j in range(a)]

go = "M"

ap = 1

for i in range(a):

    if go == "M":

        for j in range(b):

            if ar[0] == 0:

                del ar[0]

                ap += 1

            br[i][j] = ap

            ar[0] -= 1

        go = "U"

    else:

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

            if ar[0] == 0:

                del ar[0]

                ap += 1

            br[i][j] = ap

            ar[0] -= 1

        go = "M"

for r in br:

    for i in range(b-1):

        print(r[i],end=" ")

    print(r[b-1])

n,w = map(int,input().split(" "))

c = int(input())

ar = [[0 for i in range(w)] for j in range(n)]

br = list(map(int,input().split(" ")))

z = 1

for i in range(n):

    if i % 2 ==0:

        for j in range(w):

            ar[i][j] = z

            br[z-1] -= 1

            if br[z-1] == 0:

                z += 1

    else:

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

            ar[i][j] = z 

            br[z-1] -= 1

            if br[z-1] == 0:

                z += 1

for r in ar:

    for i in range(w-1):

        print(r[i],end=" ")

    print(r[w-1])

a, b = map(int, input().split(" "))
c = int(input())
ar = list(map(int, input().split(" ")))
br = [[0 for i in range(b)] for j in range(a)]
go = "M"
ap = 1
for i in range(a):
    if go == "M":
        for j in range(b):
            if ar[0] == 0:
                del ar[0]
                ap += 1
            br[i][j] = ap
            ar[0] -= 1
        go = "U"
    else:
        for j in range(b - 1, -1, -1):
            if ar[0] == 0:
                del ar[0]
                ap += 1
            br[i][j] = ap
            ar[0] -= 1
        go = "M"
for r in br:
    for i in range(b - 1):
        print(r[i], end=" ")
    print(r[b - 1])

n, w = map(int, input().split(" "))
c = int(input())
ar = [[0 for i in range(w)] for j in range(n)]
br = list(map(int, input().split(" ")))
z = 1
for i in range(n):
    if i % 2 == 0:
        for j in range(w):
            ar[i][j] = z
            br[z - 1] -= 1
            if br[z - 1] == 0:
                z += 1
    else:
        for j in range(w - 1, -1, -1):
            ar[i][j] = z
            br[z - 1] -= 1
            if br[z - 1] == 0:
                z += 1
for r in ar:
    for i in range(w - 1):
        print(r[i], end=" ")
    print(r[w - 1])

-a, b = map(int, input().split(" ")) +n, w = map(int, input().split(" ")) -ar = list(map(int, input().split(" "))) -br = [[0 for i in range(b)] for j in range(a)] -go = "M" -ap = 1 -for i in range(a): -    if go == "M": -        for j in range(b): -            if ar[0] == 0: -                del ar[0] -                ap += 1 -            br[i][j] = ap -            ar[0] -= 1 -        go = "U" +ar = [[0 for i in range(w)] for j in range(n)] +br = list(map(int, input().split(" "))) +z = 1 +for i in range(n): +    if i % 2 == 0: +        for j in range(w): +            ar[i][j] = z +            br[z - 1] -= 1 +            if br[z - 1] == 0: +                z += 1 -        for j in range(b - 1, -1, -1): -            if ar[0] == 0: -                del ar[0] -                ap += 1 -            br[i][j] = ap -            ar[0] -= 1 -        go = "M" -for r in br: -    for i in range(b - 1): +        for j in range(w - 1, -1, -1): +            ar[i][j] = z +            br[z - 1] -= 1 +            if br[z - 1] == 0: +                z += 1 +for r in ar: +    for i in range(w - 1): -    print(r[b - 1]) +    print(r[w - 1])