#include <stdio.h>
void quick_sort1(int num[], int low, int high) {//升序
    	int i, j;
    	int temp = 0;
    	int tmp;
    	i = low;
    	j = high;
    	tmp = num[low];
    	if (i > j) {
    		return;
    	}
    	while (i != j) {
    		while (num[j] >= tmp && j > i) {
    			j--;
    		}
    		while (num[i] <= tmp && j > i) {
    			i++;
    		}
    		if (j > i) {
    			temp = num[j];
    			num[j] = num[i];
    			num[i] = temp;
    		}
    	}
    	num[low] = num[i];
    	num[i] = tmp;
    	quick_sort1(num, low, i - 1);
    	quick_sort1(num, i + 1, high);
    }
void quick_sort2(int num[], int low, int high) {
    int i, j;
    int temp = 0;
    int tmp;
    i = low;
    j = high;
    tmp = num[low];
    if (i > j) {
        return;
    }
    while (i != j) {
        while (num[j] <= tmp && j > i) {
            j--;
        }
        while (num[i] >= tmp && j > i) {
            i++;
        }
        if (j > i) {
            temp = num[j];
            num[j] = num[i];
            num[i] = temp;
        }
    }
    num[low] = num[i];
    num[i] = tmp;
    quick_sort2(num, low, i - 1);
    quick_sort2(num, i + 1, high);
}
int main() {
	int arr[10] = { 0 };
	for (int i = 0; i < 10; i++){
		scanf("%d", &arr[i]);
	}
	int a[10] = { 0 };//偶数
	int b[10] = { 0 };//奇数
	int j = 0;
	int q = 0;
	for(int i =0;i<10;i++){
		if (arr[i] % 2 == 0) {
			a[j] = arr[i];
			j++;
		}
		else {
			b[q] = arr[i];
			q++;
		}		
	}
    quick_sort1(a, 0, j - 1);
    quick_sort2(b, 0, q - 1);
    for (int i = 0; i < q; i++) {
        printf("%d ", b[i]);
    }
    for (int i = 0; i < j; i++) {
        printf("%d ", a[i]);
    }
	return 0;
}