import sys



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

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

    n = int(eval(input()))

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

    B = []

    for i in range(n):

        for _ in range(A[i]):

            B.append(i + 1)



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

    for b in B:

        for h in range(H):

            for w in range(W):

                if res[h][w] == 0:

                    res[h][w] = b

                    break

            else:

                continue

            break



    for i in range(H):

        if i % 2 == 0:

            print((*res[i]))

        else:

            print((*res[i][::-1]))





if __name__ == '__main__':

    resolve()

import sys



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

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

    n = int(input())

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



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

    h, w = 0, 0

    for i in range(n):

        cnt = A[i]

        while cnt:

            grid[h][w] = i + 1

            cnt -= 1

            if w + 1 < W:

                w += 1

            else:

                h += 1

                w = 0



    for h in range(H):

        print(*grid[h]) if h % 2 == 0 else print(*grid[h][::-1])





if __name__ == '__main__':

    resolve()

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    H, W = list(map(int, input().split()))
    n = int(eval(input()))
    A = list(map(int, input().split()))
    B = []
    for i in range(n):
        for _ in range(A[i]):
            B.append(i + 1)
    res = [[0] * W for _ in range(H)]
    for b in B:
        for h in range(H):
            for w in range(W):
                if res[h][w] == 0:
                    res[h][w] = b
                    break
            else:
                continue
            break
    for i in range(H):
        if i % 2 == 0:
            print((*res[i]))
        else:
            print((*res[i][::-1]))


if __name__ == "__main__":
    resolve()

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    H, W = map(int, input().split())
    n = int(input())
    A = list(map(int, input().split()))
    grid = [[0 for _ in range(W)] for _ in range(H)]
    h, w = 0, 0
    for i in range(n):
        cnt = A[i]
        while cnt:
            grid[h][w] = i + 1
            cnt -= 1
            if w + 1 < W:
                w += 1
            else:
                h += 1
                w = 0
    for h in range(H):
        print(*grid[h]) if h % 2 == 0 else print(*grid[h][::-1])


if __name__ == "__main__":
    resolve()

-    H, W = list(map(int, input().split())) -    n = int(eval(input())) +    H, W = map(int, input().split()) +    n = int(input()) -    B = [] +    grid = [[0 for _ in range(W)] for _ in range(H)] +    h, w = 0, 0 -        for _ in range(A[i]): -            B.append(i + 1) -    res = [[0] * W for _ in range(H)] -    for b in B: -        for h in range(H): -            for w in range(W): -                if res[h][w] == 0: -                    res[h][w] = b -                    break +        cnt = A[i] +        while cnt: +            grid[h][w] = i + 1 +            cnt -= 1 +            if w + 1 < W: +                w += 1 -                continue -            break -    for i in range(H): -        if i % 2 == 0: -            print((*res[i])) -        else: -            print((*res[i][::-1])) +                h += 1 +                w = 0 +    for h in range(H): +        print(*grid[h]) if h % 2 == 0 else print(*grid[h][::-1])