def main():

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

    n = int(eval(input()))

    a = [-1] + [int(x) for x in input().split()]

    for i in range(1, n + 1):

        a[i] += a[i - 1]

    answer = ["-1" for _ in range(w * h)]

    index = 0

    for i in range(h * w):

        if not (a[index] < i <= a[index + 1]):

            index += 1

        answer[i] = str(index + 1)

    for i in range(h):

        if i % 2 == 0:

            print((" ".join(answer[i * w: (i + 1) * w])))

        else:

            print((" ".join(reversed(answer[i * w: (i + 1) * w]))))





if __name__ == '__main__':

    main()



def main():

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

    n = int(eval(input()))

    a = [int(x) for x in input().split()]

    answer = [[0 for _ in range(w)] for _ in range(h)]

    dir = [[0, w, 1], [-1, -w - 1, -1]]

    count = 0

    color = 1

    for i in range(h):

        for j in range(dir[i % 2][0], dir[i % 2][1], dir[i % 2][2]):

            answer[i][j] = color

            count += 1

            if count == a[color - 1]:

                count = 0

                color += 1

    for ans in answer:

        print((" ".join(map(str, ans))))





if __name__ == '__main__':

    main()



def main():
    h, w = list(map(int, input().split()))
    n = int(eval(input()))
    a = [-1] + [int(x) for x in input().split()]
    for i in range(1, n + 1):
        a[i] += a[i - 1]
    answer = ["-1" for _ in range(w * h)]
    index = 0
    for i in range(h * w):
        if not (a[index] < i <= a[index + 1]):
            index += 1
        answer[i] = str(index + 1)
    for i in range(h):
        if i % 2 == 0:
            print((" ".join(answer[i * w : (i + 1) * w])))
        else:
            print((" ".join(reversed(answer[i * w : (i + 1) * w]))))


if __name__ == "__main__":
    main()

def main():
    h, w = list(map(int, input().split()))
    n = int(eval(input()))
    a = [int(x) for x in input().split()]
    answer = [[0 for _ in range(w)] for _ in range(h)]
    dir = [[0, w, 1], [-1, -w - 1, -1]]
    count = 0
    color = 1
    for i in range(h):
        for j in range(dir[i % 2][0], dir[i % 2][1], dir[i % 2][2]):
            answer[i][j] = color
            count += 1
            if count == a[color - 1]:
                count = 0
                color += 1
    for ans in answer:
        print((" ".join(map(str, ans))))


if __name__ == "__main__":
    main()

-    a = [-1] + [int(x) for x in input().split()] -    for i in range(1, n + 1): -        a[i] += a[i - 1] -    answer = ["-1" for _ in range(w * h)] -    index = 0 -    for i in range(h * w): -        if not (a[index] < i <= a[index + 1]): -            index += 1 -        answer[i] = str(index + 1) +    a = [int(x) for x in input().split()] +    answer = [[0 for _ in range(w)] for _ in range(h)] +    dir = [[0, w, 1], [-1, -w - 1, -1]] +    count = 0 +    color = 1 -        if i % 2 == 0: -            print((" ".join(answer[i * w : (i + 1) * w]))) -        else: -            print((" ".join(reversed(answer[i * w : (i + 1) * w])))) +        for j in range(dir[i % 2][0], dir[i % 2][1], dir[i % 2][2]): +            answer[i][j] = color +            count += 1 +            if count == a[color - 1]: +                count = 0 +                color += 1 +    for ans in answer: +        print((" ".join(map(str, ans))))