#include <iostream>
#include <algorithm>
using namespace std;

const int MAX=100;

int odd[MAX],even[MAX];

bool com(int a,int b){
    if (a%2!=0&&b%2!=0) return a>b;//奇数降序
    else if(a%2==0&&b%2==0) return a<b;//偶数升序
    return a%2>b%2;//先输出奇数1>0
}


int main() {
    int a[10];
    while(cin>>a[0]){
        for(int i=1;i<10;i++) cin>>a[i];
        sort(a,a+10,com);
        for(int i=0;i<10;i++) cout<<a[i]<<' ';
    }
    return 0;
}
// 64 位输出请用 printf("%lld")