import Foundation
#if os(OSX) || os(iOS)
    import Darwin
#elseif os(Linux)
    import Glibc
#endif
var H = 0, W = 0, N = 0
withUnsafeMutablePointer(&H){withVaList([COpaquePointer($0)]){vscanf("%d",$0)}}
withUnsafeMutablePointer(&W){withVaList([COpaquePointer($0)]){vscanf("%d",$0)}}
withUnsafeMutablePointer(&N){withVaList([COpaquePointer($0)]){vscanf("%d",$0)}}
var a = [Int].init(count: N+1, repeatedValue: 0)
for i in 1...N {
    withUnsafeMutablePointer(&a[i]){withVaList([COpaquePointer($0)]){vscanf("%d",$0)}}
}
var reverse = false
var p = 1
var line = [String].init(count: W, repeatedValue: "")
for _ in 0..<H {
    var s = ""
    for j in 0..<W {
        if a[p] == 0 {
            p += 1
        }
        let lineCur: Int
        if reverse {
            lineCur = W-j-1
        } else {
            lineCur = j
        }
        line[lineCur] = p.description
        a[p] -= 1
    }
    print(line.joinWithSeparator(" "))
    reverse = !reverse
}