let n = Int(readLine()!)!
let a = readLine()!.characters.split(" ").map{Int(String($0))!}
var odd: [Int] = []
var even: [Int] = []
a.enumerate().forEach{$0.0 % 2 > 0 ? (odd += [$0.1]) : (even += [$0.1])}
let b = odd.reverse() + even
(n % 2 > 0 ? b.reverse() : b).forEach{print($0, terminator: " ")}