#include <bits/stdc++.h>
using namespace std;
vector<int> a;
bool cmp(int &x) {
return x % 2; //奇数放在前面
}
int main() {
int t;
for (int i = 0; i < 10; i++) {
cin >> t;
a.push_back(t);
}
vector<int>::iterator it = stable_partition(a.begin(), a.end(), cmp);
sort(a.begin(), it, greater<int>());
sort(it, a.end(), less<int>());
for (vector<int>::iterator iter = a.begin(); iter != a.end(); iter++) {
cout << *iter << ' ';
}
return 0;
}