#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int n[10],even[10],odd[10];
bool cmp(int n1,int n2){
    return n1<n2;
}
bool cmp1(int n1,int n2)
{
    return n1>n2;
}
int main() {
    int c1=0,c2=0;
    for(int i=0;i<10;i++)
    {
        cin>>n[i];
        if(n[i]%2==0)
        {
            even[c1++]=n[i];
        }
        else {
            odd[c2++]=n[i];
        }
    }
    sort(odd,odd+c2,cmp1);
    sort(even,even+c1,cmp);
    for(int i=0;i<c2;i++)cout<<odd[i]<<" ";
    for(int i=0;i<c1;i++)cout<<even[i]<<" ";


}
// 64 位输出请用 printf("%lld")