fun main(args : Array<String>) {
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toInt() }

    var tmp = mutableListOf<Int>()
    var num = 1
    var isForward = true
    var ans = mutableListOf<String>()

    aa.forEach { a ->
        repeat(a) {
            tmp.add(num)
            if (tmp.size % w == 0) {
                if (isForward) {
                    ans.add(tmp.joinToString(separator = " "))
                } else {
                    ans.add(tmp.reversed().joinToString(separator = " "))
                }
                tmp = mutableListOf()
                isForward = !isForward
            }
        }
        num++
    }

    println(ans.joinToString(separator = System.lineSeparator()))
}