#include <stdio.h>
#include <stdlib.h>

typedef struct node{
    int data;
    struct node *next;
}Node;

Node *head1 = NULL,*tail;

void create1(int num){
    Node *newnode=(Node*)malloc(1 * sizeof(Node));
    newnode->data=num;
    newnode->next=NULL;
    if(head1==NULL){
        head1=newnode;
        tail=newnode;
    }
    else{
        tail->next=newnode;
        tail=newnode;
    }
}
void sort(){
    Node *temp =head1; 
    while(temp!=NULL && temp->next!=NULL){
        if(temp->data > temp->next->data){
            temp->data = (temp->data + temp->next->data) - (temp->next->data = temp->data);
            temp=temp->next;
        }
    }
}


void display(){
    Node *itr1,*itr2;
    for(itr1=head1;itr1!=NULL;itr1=itr1->next){
        printf("%d ",itr1->data);
    //     if(itr1->data > itr1->next->data){
            
    //         itr1->data = (itr1->data + itr1->next->data) - (itr1->next->data = itr1->data);
    //     }
    // }
    // for(itr2=head1;itr2!=NULL;itr2=itr2->next){
    //     printf("%d",itr2->data);
    }
}

int main(){
    int n1,n2,ind,num,num2;
    scanf("%d",&n1);
    for(ind=0;ind<n1;ind++){
        scanf("%d",&num);
        create1(num);
    }
    
    scanf("%d",&n2);
    for(ind=0;ind<n2;ind++){
        scanf("%d",&num);
        create1(num);
    }
    sort();
    display();
    return 0;
}