let h, w, n = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let ans, c = Array.make_matrix h w 0, ref 0
let rec f i = if a_s.(i) = 0 then f (i + 1) else (a_s.(i) <- a_s.(i) - 1; i)
let _ = for i = 0 to h - 1 do for j = 0 to w - 1 do c := f !c; ans.(i).(if i mod 2 = 1 then w - 1 - j else j) <- !c + 1 done done; Array.(iter (fun cs -> to_list cs |> List.map string_of_int |> String.concat " " |> print_endline) ans)