#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void splitArray(const vector<int>& arr) {
    vector<int> odd, even;

    // Separate even and odd numbers
    for (int num : arr) {
        if (num % 2 == 0)
            even.push_back(num);
        else
            odd.push_back(num);
    }

    // Sort both arrays
    sort(odd.begin(), odd.end());
    sort(even.begin(), even.end());

    // Print odd numbers
    for (int num : odd)
        cout << num;
    cout << endl;

    // Print even numbers
    for (int num : even)
        cout << num;
    cout << endl;
}

int main() {
    vector<int> arr = {9, 8, 7, 6, 5, 4, 3, 2, 1};
    splitArray(arr);
    return 0;

}