import java.util.*

fun main(args: Array<String>) {
    arc080d()
}

private enum class Direction { RIGHT, LEFT, UP, DOWN }

fun arc080d() {
    val (h, w) = readLine()!!.split(' ').map { it.toInt() }
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map { it.toInt() }

    val answer = Array(h) { IntArray(w) { -1 } }
    val queue = PriorityQueue(aList.mapIndexed { index, a -> (1..a).map { index + 1 } }.flatten())
    answer[0][0] = queue.poll()
    var direction = Direction.UP
    var x = 0
    var y = 0
    while (queue.isNotEmpty()) {
        when (direction) {
            Direction.RIGHT -> {
                if (x + 1 < w && answer[y][x + 1] == -1) {
                    answer[y][++x] = queue.poll()
                } else {
                    direction = Direction.DOWN
                }
            }
            Direction.LEFT -> {
                if (x - 1 >= 0 && answer[y][x - 1] == -1) {
                    answer[y][--x] = queue.poll()
                } else {
                    direction = Direction.UP
                }
            }
            Direction.UP -> {
                if (y + 1 < h && answer[y + 1][x] == -1) {
                    answer[++y][x] = queue.poll()
                } else {
                    direction = Direction.RIGHT
                }
            }
            Direction.DOWN -> {
                if (y - 1 >= 0 && answer[y - 1][x] == -1) {
                    answer[--y][x] = queue.poll()
                } else {
                    direction = Direction.LEFT
                }
            }
        }
    }

    println(answer.joinToString(System.lineSeparator()) { it.joinToString(" ") })
}
