import Data.Sequence ((|>),(<|))
import qualified Data.Sequence as Q
import qualified Data.ByteString.Char8 as B
import Data.Maybe
import Data.List

readInts = map (fst . fromJust . B.readInt) . B.words

main = do
 getLine
 as <- readInts <$> B.getLine
 let q = (pushpush as)
 let l = Q.length q
 let ret = if odd l then Q.reverse q else q
 putStrLn $ unwords $ Q.foldrWithIndex (\_ a acc -> show a : acc) [] ret

pushpush = fst . foldl' addq (Q.empty, False)

addq (q,False) a = (q |> a, True)
addq (q, True) a = (a <| q, False)