import Data.List
 
main :: IO ()
main = interact $ foldr (\s ss -> show s ++ ' ':ss) [] . solve_r . foldl' solve [] . map read . drop 1 . words
 
solve :: [Int] -> Int -> [Int]
solve xs x = if odd $ length xs then xs ++ x:[] else x:xs

solve_r :: [Int] -> [Int]
solve_r xs = if even $ length xs then reverse xs else xs
