#include <iostream>
using namespace std;
const int MAX_LENGTH = 1000;
int main() {
int n, v[MAX_LENGTH + 1];
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> v[i];
}
for (int i = n; i >= 1; --i) {
if (v[i] % 2 == 0) {
cout << v[i] << ' ';
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1BWF9MRU5HVEggPSAxMDAwOwoKaW50IG1haW4oKSB7CiAgICBpbnQgbiwgdltNQVhfTEVOR1RIICsgMV07CiAgICBjaW4gPj4gbjsKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47ICsraSkgewogICAgICAgIGNpbiA+PiB2W2ldOwogICAgfQogICAgZm9yIChpbnQgaSA9IG47IGkgPj0gMTsgLS1pKSB7CiAgICAgICAgaWYgKHZbaV0gJSAyID09IDApIHsKICAgICAgICAgICAgY291dCA8PCB2W2ldIDw8ICcgJzsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gMDsKfQ==