#include <iostream>
#include <vector>

using namespace std;

int main() {
    // Optimize I/O speed
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    if (!(cin >> n)) return 0;

    vector<long long> a(n), b(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];

    int i = 0, j = 0;
    
    // Merge the 2 arrays using the two pointers technique
    while (i < n && j < n) {
        if (a[i] <= b[j]) {
            cout << a[i] << " ";
            i++;
        } else {
            cout << b[j] << " ";
            j++;
        }
    }

    // Print remaining elements of array A (if any)
    while (i < n) {
        cout << a[i] << " ";
        i++;
    }

    // Print remaining elements of array B (if any)
    while (j < n) {
        cout << b[j] << " ";
        j++;
    }

    return 0;
}