#include <stdio.h>
#include <stdlib.h>


int cmp1(const void* a, const void* b) {
    return *(int*)a < *(int*)b;
}
int cmp2(const void* a, const void* b) {
    return *(int*)a > *(int*)b;
}
int main() {
    int a[10];
    int odd[10], even[10];
    int oddCount = 0, evenCount = 0;

    while (scanf("%d %d %d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &a[4],
                 &a[5], &a[6], &a[7], &a[8], &a[9]) != EOF) {
        oddCount = evenCount = 0;

        // 将奇数和偶数分别存储在两个数组中
        for (int i = 0; i < 10; i++) {
            if (a[i] % 2 == 1) {
                odd[oddCount++] = a[i];
            } else {
                even[evenCount++] = a[i];
            }
        }

        // 对奇数数组进行降序排序
        qsort(odd, oddCount, sizeof(int), cmp1);
        /*冒泡排序写法
        for (int i = 0; i < oddCount - 1; i++) {
            for (int j = 0; j < oddCount - i - 1; j++) {
                if (odd[j] < odd[j + 1]) {
                    int temp = odd[j];
                    odd[j] = odd[j + 1];
                    odd[j + 1] = temp;
                }
            }
        }        
        */

        // 对偶数数组进行升序排序
        qsort(even, evenCount, sizeof(int), cmp2);
        /*冒泡排序写法
        for (int i = 0; i < evenCount - 1; i++) {
            for (int j = 0; j < evenCount - i - 1; j++) {
                if (even[j] > even[j + 1]) {
                    int temp = even[j];
                    even[j] = even[j + 1];
                    even[j + 1] = temp;
                }
            }
        }
        */


        // 输出排序后的奇数和偶数
        for (int i = 0; i < oddCount; i++) {
            printf("%d ", odd[i]);
        }
        for (int i = 0; i < evenCount; i++) {
            printf("%d ", even[i]);
        }
        printf("\n"); // 每组数据输出后换行
    }
    return 0;
}