#include<iostream>
#include<algorithm>
using namespace std;
int a[10];
bool compare(int x,int y){ //构造比较函数
if(x%2==1&&y%2==1)return x>y;
else if(x%2==0&&y%2==0)return x<y;
else return (x%2>y%2);
}
int main(){
while(cin>>a[0]){
for(int i=1;i<10;i++)cin>>a[i];
sort(a,a+10,compare);
for(int i=0;i<10;i++)cout<<a[i]<<" ";
}
return 0;
}
#include<algorithm>
using namespace std;
int a[10];
bool compare(int x,int y){ //构造比较函数
if(x%2==1&&y%2==1)return x>y;
else if(x%2==0&&y%2==0)return x<y;
else return (x%2>y%2);
}
int main(){
while(cin>>a[0]){
for(int i=1;i<10;i++)cin>>a[i];
sort(a,a+10,compare);
for(int i=0;i<10;i++)cout<<a[i]<<" ";
}
return 0;
}