
let n = read_int ();;

let to_ints (lst : string list):int list = 
 (List.map (fun x -> (int_of_string x)) lst);;

let rec print_list list_ints =
     match list_ints with
    [] -> print_newline ()
     | t::h -> print_int t; print_string " "; print_list h;;

let rec print_llist llist =
  match llist with
  [] -> print_string "\n"
   | t::h -> print_list t; print_llist h
   
let rec ins n list =
  match list with
    [] -> [n]
  | h::t -> if n <= h then n::h::t
    else h::(ins n t);;
 
let rec aux acc llist list =
  match list with
    [] ->  llist
  | h::t ->
     let i = (ins h acc) in
     aux i ((i @ t) :: llist) t;;

let insort list =
  print_llist 
    (List.rev (aux [] [] list));;


let lst = (to_ints (Str.split (Str.regexp " ") (read_line ()))) in
insort lst;;