open System

let [| h; w |] = stdin.ReadLine().Split() |> Array.map int
let n = stdin.ReadLine() |> int
let a = stdin.ReadLine().Split() |> Array.map int

let s = Array.mapi (fun i a -> Array.replicate a (i+1)) a |> Array.concat

for i in [0 .. h-1] do
    let t = s.[i*w .. (i+1)*w-1]
    let t = if i % 2 = 0 then t else Array.rev t
    Array.map string t
    |> String.concat " "
    |> printfn "%s"
