let id x = x
let n = Scanf.scanf "%d\n" id

let array = Array.init n (fun _ -> (Scanf.scanf "%d ") id)
  
let list = Array.to_list array

let rec fact m l =
  if m = n then l else
    fact (m+1) (List.rev (l @ [array.(m)]))

let ans = Array.of_list (fact 0 [])

  
let () =
  let rec output s =
    if s = n then print_string "\n"
    else
      (Printf.printf "%d " ans.(s); output (s+1)) in output 0