import Control.Monad
import Data.List
import Data.Maybe (fromJust)
import Data.Char (isSpace)
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
  
main = do
  n <- readLn :: IO Int
  v <- VU.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine :: IO (VU.Vector Int)
  VU.forM_ (solve v n) (\x -> putStr $ show x ++ " ")

solve :: VU.Vector Int -> Int -> VU.Vector Int
solve v n
  | even n = VU.reverse evs VU.++ ods 
  | otherwise = VU.reverse ods VU.++ evs    
    where
      ods = VU.filter (\x -> odd . (+1) . fromJust $ VU.findIndex (==x) v) v
      evs = VU.filter (\x -> even . (+1) . fromJust $ VU.findIndex (==x) v) v