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

int main() {
    int a[10];
    int odd=0;
    for(int i=0;i<10;i++){
        cin>>a[i];
        if(a[i]%2==0)odd=odd+1;
    }
    int qi=10-odd;
    int ou[odd],ji[qi];
    int t1=0;int t2=0;
    for(int i=0;i<10;i++){
        if(a[i]%2==0){ou[t1]=a[i];t1=t1+1;}
        else{ji[t2]=a[i];t2=t2+1;}
    }
    //paixu
    int temp;
    for(int i=0;i<odd-1;i++){//xiaodaoda
        for(int j=i+1;j<odd;j++){
            if(ou[j]<ou[i]){
                temp=ou[i];
                ou[i]=ou[j];
                ou[j]=temp;
            }
        }
    }
    for(int i=0;i<qi-1;i++){//dadaoxiao
        for(int j=i+1;j<qi;j++){
            if(ji[j]>ji[i]){
                temp=ji[i];
                ji[i]=ji[j];
                ji[j]=temp;
            }
        }
    }
    for(int i=0;i<qi;i++)cout<<ji[i]<<" ";
    for(int i=0;i<odd;i++)cout<<ou[i]<<" ";
}