-- Question C Time Over

import Control.Applicative
import Control.Monad

main = do
  n <- readLn ::IO Int
  zs <- (map read . words) <$> getLine 
  putStr $ unwords ( map show ( try' n zs) )
  
try' n zs = reverse ([ x | x<-zs, x `mod` 2 /= n `mod` 2])++[]++ [ x | x<-zs, x `mod` 2 == n `mod` 2]
