#include #include #include using namespace std; int main() { const int ROWS = 3, COLS = 3; int arr[ROWS][COLS]; for (int i = 0; i < ROWS; ++i) { for (int j = 0; j < COLS; ++j) { cin >> arr[i][j]; } } int n; cin >> n; vector inputNumbers(n); for (int i = 0; i < n; ++i) { cin >> inputNumbers[i]; } vector allNumbers; for (int i = 0; i < ROWS; ++i) { for (int j = 0; j < COLS; ++j) { allNumbers.push_back(arr[i][j]); } } for (int num : inputNumbers) { allNumbers.push_back(num); } sort(allNumbers.begin(), allNumbers.end()); vector smallestNumbers(allNumbers.begin(), allNumbers.begin() + 9); // Assuming we need the smallest 9 numbers vector oddNumbers, evenNumbers; for (int num : smallestNumbers) { if (num % 2 == 1) { oddNumbers.push_back(num); } else { evenNumbers.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; }