import Data.List

main = interact $ unwords . map show . sol . map read . words

sol (n:as)
  | even n    = es ++ reverse os
  | otherwise = os ++ reverse es
  where
  (i,es,os) = foldl' f (0,[],[]) as

f (i,es,os) a
  | even i    = (i+1,es,a:os)
  | otherwise = (i+1,a:es,os)