let () =
  let (h, w) = Scanf.scanf "%d %d " (fun h w -> h, w) in
  let n = Scanf.scanf "%d " (fun n -> n) in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun i -> i)) in
  let t = Array.make_matrix h w 0 in
  let rec doit c m = function
    | (i, _) when i = h -> ()
    | (i, j) ->
      if j = w then doit c false (i + 1, j - 1)
      else if j = (-1) then doit c true (i + 1, j + 1)
      else begin
        let c = if a.(c) = 0 then c + 1 else c in
        t.(i).(j) <- c + 1;
        a.(c) <- a.(c) - 1;
        doit c m (i, if m then j + 1 else j - 1)
      end in
  doit 0 true (0, 0);
  for i = 0 to h - 1 do
    for j = 0 to w - 1 do
      Printf.printf (if j = 0 then "%d" else " %d") t.(i).(j)
    done;
    print_newline ()
  done