#include <iostream>
#include <cstdio>
#include <algorithm>
 
using namespace std;
int arr[10];

bool Compare(int x,int y){
    if(x%2==0&&y%2==0)
        return x<y;
    else if(x%2==1&&y%2==1)
        return  x>y;
    else if(x%2==1&&y%2==0)
        return true;
    else
        return false;
}

int main(){
    while(scanf("%d", &arr[0])!=EOF){        //输入10个整数,彼此以空格分隔,等于用十次EOF
        for(int i=1;i<10;i++){
            scanf("%d",&arr[i]);
        }
        sort(arr, arr+10,Compare);
        for(int i=0;i<10;i++)
            printf("%d ",arr[i]);        //对于每组数据,按照要求排序后输出,由空格分隔
    }
    return 0;
}