#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int data;
    struct node *next;
}node;
node *head=NULL,*tail;

typedef struct node2{
    int dataa;
    struct node *nexta;
}nodea
nodea *heada=NULL,*taila;

void createa(int n1){
    node *newnode=(node*)malloc(1*sizeof(node));
    newnode->data=n1;
    newnode->next=NULL;
    if(head==NULL){
        head=newnode;
        tail=newnode;
    }
    else{
        tail->next=newnode;
        tail=newnode;
    }
}

void createb(int n2){
    nodea *newnode=(nodea*)malloc(1*sizeof(nodea));
    newnode->dataa=n2;
    newnode->nexta=NULL;
    if(heada==NULL){
        heada=newnode;
        taila=newnode;
    }
    else{
        taila->nexta=newnode;
        taila=newnode;
    }
}

void display(){
    node *it,*itr;
    for(it=head;it!=NULL;it=it->next){
        printf("%d ",it->data);
    }
    for(itr=heada;itr!=NULL;itr=itr->nexta){
        printf("%d ",itr->dataa);
    }
}

int main(){
    int s1,s2,a,b,i,j;
    scanf("%d",&s1);
    for(i=0;i<s1;i++){
        scanf("%d",&a);
    }
    
    
    scanf("%d",&s2);
    for(j=0;j<s2;j++){
        scanf("%d",&b);
    }
    
    createa(a);
    createb(b);
    
    display();
    return 0;
}