#include<stdio.h>
#include<string.h>
#include <stdlib.h>
int main(int argc,char * argv[]){
int n;
while(scanf("%d",&n)!=EOF){
int i,j,m,k;
int a[101],b[101],c[202];
for(i=0;i<n;++i) scanf("%d",&a[i]);
scanf("%d",&m);
for(i=0;i<m;++i) scanf("%d",&b[i]);
/for(i=0;i<n;++i) printf("%d “,a[i]);
printf(”\n");
for(i=0;i<m;++i) printf("%d ",b[i]);/
i=j=k=0;
while(i<n&&j<m){
if(a[i]<=b[j]) c[k++]=a[i++];
else c[k++]=b[j++];
}
while(i<n) c[k++]=a[i++];
while(j<m) c[k++]=b[j++];
for(i=0;i<k;++i) printf("%d “,c[i]);
printf(”\n");
}
return 0;
}