fun main(args: Array<String>){
    val (h, w) = readLine()!!.split(" ").map(String::toInt)
    val n = readLine()!!.toInt()
    val al = readLine()!!.split(" ").map(String::toInt)
    val ms = mutableListOf<Int>()
    al.forEachIndexed {
        index, a -> for (i in 0 until a) ms.add(index + 1)
    }
    for (j in 0 until h) {
        val output = if (j % 2 == 0) ms.slice((j * w) until ((j + 1) * w))
                     else ms.slice((j * w) until ((j + 1) * w)).reversed()
        output.forEachIndexed {
            index, o -> print(o.toString() + if (index < w - 1) " " else "\n")
        }
    }
}
