#include <iostream>
using namespace std;
//read two arrays a and b by 5 elements and sort arrays a,b by bubble sort Ascending
int main(){
int a[5],b[5];
int i,j,temp;
for(i=0;i<5;i++){
cin>>a[i];
}
for(i=0;i<5;i++){
cin>>b[i];
}
for(i=0;i<5;i++){
for(j=0;j<5;j++){
if(a[i]<a[j]){
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
for(i=0;i<5;i++){
for(j=0;j<5;j++){
if(b[i]<b[j]){
temp=b[i];
b[i]=b[j];
b[j]=temp;
}
}
}
//merge a and b sorted to c
int c[10];
i=0;
j=0;
int k=0;
while(i<5&&j<5){
if(a[i]<b[j]){
c[k]=a[i];
i++;
}
else{
c[k]=b[j];
j++;
}
k++;
}
while(i<5){
c[k]=a[i];
i++;
k++;
}
while(j<5){
c[k]=b[j];
j++;
k++;
}
for(int i=0;i<10;i++){
cout<<c[i]<<" ";
}
return 0;
}