#include
using namespace std;
struct node{
long long int data;
struct node *next;
};
struct node *p,*s;
void addtrail(node &head,long long int data){
noden=new node;
n->data=data;
n->next=NULL;
if(head==NULL){
head=n;
p=n;
}
p->next=n;
p=n;
}
void merge(node *&head1,node *&head2,node *&head3){
if (head1->data <= head2->data) {
head3 = head1;
head1 = head1->next;
} else {
head3 = head2;
head2 = head2->next;
}
node *current = head3;
while (head1 != NULL && head2 != NULL) {
if (head1->data <= head2->data) {
current->next = head1;
head1 = head1->next;
} else {
current->next = head2;
head2 = head2->next;
}
current = current->next;
}
if (head1 == NULL) {
current->next = head2;
} else {
current->next = head1;
}
}
int main() {
long int h;
cin>>h;
for(long int l=0;l<h;l++){
long long int n;
cin>>n;
long long int a[n];
node *head1=NULL;
for(long long int i=0;i<n;i++){
cin>>a[i];
addtrail(head1,a[i]);
}
long long int m;
cin>>m;
long long int b[m];
node head2=NULL;
for(long long int i=0;i<m;i++){
cin>>b[i];
addtrail(head2,b[i]);
}
node head3=NULL;
merge(head1,head2,head3);
node *u=head3;
while(u){
cout<data<<" “;
u=u->next;
}
cout<<”\n";
}
return 0;
}