let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let as_ = Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in
  Array.fold_left (fun (xs, ys) a -> (ys, a :: xs)) ([], []) as_
  |> (fun (xs, ys) -> ys @ List.rev xs)
  |> List.iter (Printf.printf "%d ")