let insertion_sort n v =
  let rec insert v = function
      0 -> v
    | i ->
      let j = i-1 in
      let vi,vj = v.(i),v.(j) in
      if vj <= vi then v
      else (v.(i) <- vj; v.(j) <- vi; insert v j)
  in
  let rec loop v i = if i >= n then v
    else
      let inserted = insert v i in
      for j = 1 to n do
        Printf.printf (if j=n then "%d\n" else "%d ") inserted.(j-1)
      done;
      loop inserted (i+1)
  in loop v 0

let () =
  let n = read_int () in
  let v = read_line () |> Str.split (Str.regexp " ")
          |> List.map int_of_string |> Array.of_list in
  let _ = insertion_sort n v in
  ()