open Str;;

let rec inser l n =
    if l=[] then n::[]
    else if (List.hd l) > n then n::l
    else (List.hd l)::(inser (List.tl l) n)


let rec print_list = function 
    [] -> ()
    |[a] -> print_int a
    | e::l -> print_int e ; print_string " " ; print_list l


let rec ins_sort alist blist =
    print_list (alist@blist) ;
    print_newline () ;
    if blist=[] then
        alist
    else
        let bhd = (List.hd blist) in
        let btl = (List.tl blist) in

        ins_sort (inser alist bhd) btl


let rec lists n =
    if n=1 then []
    else
        let item = Scanf.scanf "%d" (fun x->x) in
        item::(lists (n-1))

let final () = 0 

let  () =

    let num = Scanf.scanf "%d" (fun x->x) in
    let input = List.map int_of_string (split (regexp " ") (read_line ())) in
    if num=1 
        then  print_int (List.hd input) 
    else (
        let () = ignore (ins_sort [List.hd input] (List.tl input) ) in
        ()
    )