#include<iostream>
using namespace std;
int s1[105],s2[105],res[210];
int main(){
int n,m;
cin>>n;
for(int i=0;i<n;i++) cin>>s1[i];
cin>>m;
for(int i=0;i<m;i++) cin>>s2[i];
int i=0,j=0,k=0;
for(;i<n&&j<m;){
if(s1[i]<=s2[j]){
res[k++]=s1[i++];
}
else{
res[k++]=s2[j++];
}
}
while(i<n){
res[k++]=s1[i++];
}
while(j<m) res[k++]=s2[j++];
for(int i=0;i<k;i++) cout<<res[i]<<" ";
return 0;
}