#include "cstdio"
#include "algorithm"

using namespace std;

bool comp(int left, int right) {
    return left > right;
}

int main() {
    int n = 10;
    int arr[101];
    int res[10];
    for (int i = 0; i < n; ++i) {
        scanf("%d", &arr[i]);
        res[i] = arr[i];
    }

    // 1 奇数
    int  begin = 0;
    for (int i = 0; i < n; ++i) {
        if (arr[i] % 2 == 1) {
            res[begin++] = arr[i];
        }
    }
    sort(res, res + begin, comp);
    for (int i = 0; i < begin; ++i) {
        printf("%d ", res[i]);
    }
//    printf("\n");

    // 2. 偶数
    begin = 0;
    for (int i = 0; i < n; ++i) {
        if (arr[i] % 2 == 0) {
            res[begin++] = arr[i];
        }
    }
    sort(res, res + begin);
    for (int i = 0; i < begin; ++i) {
        printf("%d", res[i]);
        if (i < begin + 1)
            printf(" ");
    }
    return 0;
}