import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import Data.List

main = do
  n <- readLn :: IO Int
  a <- getIntListBC
  let odd = unwords . map show . fst . unzip . filter (\(x, y) -> mod y 2 /= 0) $ zip a [1..n]
      even = unwords . map show . fst . unzip . filter (\(x, y) -> mod y 2 == 0) $ zip a [1..n]
  if 0 == mod n 2
    then putStrLn $ (reverse even) ++ " " ++ odd
    else putStrLn $ (reverse odd) ++ " " ++ even

bsToInt :: BC.ByteString -> Int
bsToInt = fst . fromJust . BC.readInt

getIntListBC :: IO [Int]
getIntListBC = map bsToInt . BC.words <$> BC.getLine
