#include<iostream> #include<algorithm> using namespace std; bool compare1(int left, int right) { if (left > right) { return true; } else return false; } bool compare2(int left, int right) { if (right > left) { return true; } else return false; } void swap2(int* a, int* b) { int temp; temp = *a; *a = *b; *b = temp; } int main() { int array[10]; while (scanf("%d %d %d %d %d %d %d %d %d %d",array,array+1,array+2,array+3,array+4,array+5,array+6,array+7,array+8,array+9)!=EOF) { int odd = 0; for (int i = 0; i < 10; i++) { if (array[i] % 2 != 0) { swap2(array+i, array+odd); odd++; } } sort(array, array + odd, compare1); sort(array + odd, array + 10, compare2); for (int i = 0; i < 10; i++) { cout << array[i] << " "; } printf("\n"); } return 0; }