import Data.Maybe
import qualified Data.ByteString.Char8 as B
main=putStrLn.unwords.map show.solve.map (fst.fromJust.B.readInt).B.words=<<B.getContents
solve (n:as)
  |odd n=reverse a1s++a2s
  |otherwise=reverse a2s++a1s
  where (a1s,a2s)=(f odd&&&f even)as
f g=map snd.filter (g.fst).zip [1..]