def main():

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

    n=int(eval(input()))

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

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

    x=y=key=0

    for i in range(n):

        for _ in range(a[i]):

            ans[x][y]=str(i+1)

            if key==0:

                y+=1

            else:

                y-=1

            if key==0 and y==w:

                x+=1

                y-=1

                key=1

            elif key==1 and y==-1:

                x+=1

                y+=1

                key=0

    for i in range(h):

        print((" ".join(ans[i])))

if __name__ == "__main__":

    main()
import sys, bisect, math, itertools, string, queue, copy

# import numpy as np

# import scipy

from collections import Counter,defaultdict,deque

from itertools import permutations, combinations

from heapq import heappop, heappush

input = sys.stdin.readline

sys.setrecursionlimit(10**8)

mod = 10**9+7

def inp(): return int(eval(input()))

def inpm(): return list(map(int,input().split()))

def inpl(): return list(map(int, input().split()))

def inpls(): return list(input().split())

def inplm(n): return list(int(eval(input())) for _ in range(n))

def inplL(n): return [list(eval(input())) for _ in range(n)]

def inplT(n): return [tuple(eval(input())) for _ in range(n)]

def inpll(n): return [list(map(int, input().split())) for _ in range(n)]

def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])



def main():

    h,w = inpm()

    n = inp()

    a = inpl()

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

    x,y,key = 0,0,1

    for i in range(n):

        for j in range(a[i]):

            ans[x][y] = str(i+1)

            if key:

                x += 1

                if x == h:

                    key = 0

                    x -= 1

                    y += 1

            else:

                x -= 1

                if x == -1:

                    key = 1

                    x += 1

                    y += 1

    for i in range(h):

        print((' '.join(ans[i])))

    

if __name__ == "__main__":

    main()
def main():
    h, w = list(map(int, input().split()))
    n = int(eval(input()))
    a = list(map(int, input().split()))
    ans = [[0 for _ in range(w)] for _ in range(h)]
    x = y = key = 0
    for i in range(n):
        for _ in range(a[i]):
            ans[x][y] = str(i + 1)
            if key == 0:
                y += 1
            else:
                y -= 1
            if key == 0 and y == w:
                x += 1
                y -= 1
                key = 1
            elif key == 1 and y == -1:
                x += 1
                y += 1
                key = 0
    for i in range(h):
        print((" ".join(ans[i])))


if __name__ == "__main__":
    main()

import sys, bisect, math, itertools, string, queue, copy

# import numpy as np
# import scipy
from collections import Counter, defaultdict, deque
from itertools import permutations, combinations
from heapq import heappop, heappush

input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9 + 7


def inp():
    return int(eval(input()))


def inpm():
    return list(map(int, input().split()))


def inpl():
    return list(map(int, input().split()))


def inpls():
    return list(input().split())


def inplm(n):
    return list(int(eval(input())) for _ in range(n))


def inplL(n):
    return [list(eval(input())) for _ in range(n)]


def inplT(n):
    return [tuple(eval(input())) for _ in range(n)]


def inpll(n):
    return [list(map(int, input().split())) for _ in range(n)]


def inplls(n):
    return sorted([list(map(int, input().split())) for _ in range(n)])


def main():
    h, w = inpm()
    n = inp()
    a = inpl()
    ans = [[0 for _ in range(w)] for _ in range(h)]
    x, y, key = 0, 0, 1
    for i in range(n):
        for j in range(a[i]):
            ans[x][y] = str(i + 1)
            if key:
                x += 1
                if x == h:
                    key = 0
                    x -= 1
                    y += 1
            else:
                x -= 1
                if x == -1:
                    key = 1
                    x += 1
                    y += 1
    for i in range(h):
        print((" ".join(ans[i])))


if __name__ == "__main__":
    main()

+import sys, bisect, math, itertools, string, queue, copy + +# import numpy as np +# import scipy +from collections import Counter, defaultdict, deque +from itertools import permutations, combinations +from heapq import heappop, heappush + +input = sys.stdin.readline +sys.setrecursionlimit(10**8) +mod = 10**9 + 7 + + +def inp(): +    return int(eval(input())) + + +def inpm(): +    return list(map(int, input().split())) + + +def inpl(): +    return list(map(int, input().split())) + + +def inpls(): +    return list(input().split()) + + +def inplm(n): +    return list(int(eval(input())) for _ in range(n)) + + +def inplL(n): +    return [list(eval(input())) for _ in range(n)] + + +def inplT(n): +    return [tuple(eval(input())) for _ in range(n)] + + +def inpll(n): +    return [list(map(int, input().split())) for _ in range(n)] + + +def inplls(n): +    return sorted([list(map(int, input().split())) for _ in range(n)]) + + -    h, w = list(map(int, input().split())) -    n = int(eval(input())) -    a = list(map(int, input().split())) +    h, w = inpm() +    n = inp() +    a = inpl() -    x = y = key = 0 +    x, y, key = 0, 0, 1 -        for _ in range(a[i]): +        for j in range(a[i]): -            if key == 0: -                y += 1 +            if key: +                x += 1 +                if x == h: +                    key = 0 +                    x -= 1 +                    y += 1 -                y -= 1 -            if key == 0 and y == w: -                x += 1 -                y -= 1 -                key = 1 -            elif key == 1 and y == -1: -                x += 1 -                y += 1 -                key = 0 +                x -= 1 +                if x == -1: +                    key = 1 +                    x += 1 +                    y += 1