#include <iostream>
#include<list>
using namespace std;

int main() {
    list<int> l1;
    int x;
    while (cin >> x) {
        l1.push_back(x);
        if(cin.peek()=='\n')
        break;
    }
    list<int> l2;
    while (cin >> x)
    {
        l2.push_back(x);
         if(cin.peek()=='\n')
        break;
    }
        
    list<int> l3;
    auto it1=l1.begin();
    auto it2=l2.begin();
    while (it1!=l1.end()&&it2!=l2.end()) {
        if (*it1<*it2) {
            l3.push_back(*it1);
            it1++;
        } else {
            l3.push_back(*it2);
            it2++;
        }
    }
    while(it1!=l1.end())
    {
        l3.push_back(*it1);
        it1++;
    }
    while(it2!=l2.end())
    {
        l3.push_back(*it2);
        it2++;
    }
    for(auto e:l3)
    cout<<e<<" ";
    cout<<endl;
    return 0;
}
// 64 位输出请用 printf("%lld")