#include<stdio.h>
#include<malloc.h>
typedef struct LNode{
int data;
struct LNode*next;
}LNode,*LinkList;
int main(){
LNode *head1,*head2;
head1=(LNode*)malloc(sizeof(LNode));
head1->next=NULL;
head2=(LNode*)malloc(sizeof(LNode));
head2->next=NULL;
int n1,n2;
int x,y;
LNode*p1,*p2,*r=head1,*s=head2;
scanf("%d",&n1);
for(int i=0;i<n1;i++){
p1=(LNode*)malloc(sizeof(LNode));
r->next=p1;
scanf("%d",&x);
p1->data=x;
r=p1;
}
r->next=NULL;
scanf("%d",&n2);
for(int i=0;i<n2;i++){
p2=(LNode*)malloc(sizeof(LNode));
s->next=p2;
scanf("%d",&y);
p2->data=y;
s=p2;
}
s->next=NULL;
r->next=head2->next;
LNode*a=head1->next;
while(a!=NULL){
printf("%d ",a->data);
a=a->next;
}
return 0;
}