fun main(args: Array<String>) {
    val (H, W) = readLine()!!.split(" ").map { it.toInt() }
    val N = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    val result = Array(H, { IntArray(W, { 0 })})

    var i = 0
    var cur = 0
    while (i < H) {
        val indices = if (i % 2 == 0) (0..W-1) else (0..W-1).reversed()

        indices.forEach {j ->
            result[i][j] = cur + 1
            a[cur]--
            if (cur < N && a[cur] == 0) {
                cur++
            }
        }
        if (cur < N && a[cur] == 0) {
            cur++
        }
        i++
    }

    result.forEach {
        println(it.joinToString(" "))
    }
}