#include <algorithm>
#include <iostream>
#define maxn 12
using namespace std;

int main() {
    int *A = (int*)malloc(sizeof(int)*(maxn));
    while(cin>>A[0]>>A[1]>>A[2]>>A[3]>>A[4]>>A[5]>>A[6]>>A[7]>>A[8]>>A[9]){
        int *B = (int*)malloc(sizeof(int)*(maxn));
        int *C = (int*)malloc(sizeof(int)*(maxn));
        int count_B = 0, count_C = 0;
        int j=0,k=0;
        for(int i=0;i<10;i++){
            if(A[i]%2==0) {count_B ++; B[j++]=A[i];}
            else {count_C ++; C[k++]=A[i];}
        }
        sort(B, B+count_B);
        sort(C, C+count_C, greater<int>());
        for(int i=0;i<count_C;i++) cout<<C[i]<<" ";
        for(int i=0;i<count_B;i++) cout<<B[i]<<" ";
        cout<<endl;
    }
    return 0;
}