#include #include #include using namespace std; int main() { int matrix[3][3] = { {9, 8, 7}, {6, 5, 4}, {3, 2, 1} }; vector oddNumbers; vector evenNumbers; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (matrix[i][j] % 2 == 0) evenNumbers.push_back(matrix[i][j]); else oddNumbers.push_back(matrix[i][j]); } } int n; cin >> n; for (int i = 0; i < n; i++) { int num; cin >> num; if (num % 2 == 0) evenNumbers.push_back(num); else oddNumbers.push_back(num); } sort(oddNumbers.begin(), oddNumbers.end()); sort(evenNumbers.begin(), evenNumbers.end()); for (int num : oddNumbers) { cout << num << " "; } cout << endl; for (int num : evenNumbers) { cout << num << " "; } cout << endl; return 0; }