#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct __LinkedList_ts {
    int value;
    struct __LinkedList_ts* next;
} LinkedList_ts;

LinkedList_ts* LinkedList_new(int value)
{
    LinkedList_ts* result = NULL;

    result = (LinkedList_ts*)malloc(sizeof(LinkedList_ts));
    result->value = value;
    result->next = NULL;

    return result;
}

LinkedList_ts* LinkedList_add(LinkedList_ts* head, int value)
{
    LinkedList_ts* result = NULL;
    LinkedList_ts* curr = NULL;
    LinkedList_ts* next = NULL;
    LinkedList_ts* node = NULL;

    node = LinkedList_new(value);

    if (head == NULL) {
        head = node;
    } else {
        for (curr=head; curr!=NULL; curr=curr->next) {
            next = curr->next;
            if (value < curr->value) {
                if (curr == head) {
                    node->next = head;
                    head = node;
                    break;
                } else {}
            } else if (value > curr->value) {
                if (next == NULL) {
                    curr->next = node;
                    break;
                } else {
                    if (value < next->value) {
                        curr->next = node;
                        node->next = next;
                        break;
                    } else {}
                }
            } else {
                free(node);
            }
        }
    }

    result = head;
    return result;
}

void LinkedList_free(LinkedList_ts* head)
{
    LinkedList_ts* curr = NULL;
    LinkedList_ts* next = NULL;

    for (curr=head; curr!=NULL; curr=next) {
        next = curr->next;
        free(curr);
    }
    head = NULL;
}
int main() {
    int n;
    int i, value;
    LinkedList_ts* head = NULL;
    LinkedList_ts* curr = NULL;

    scanf("%d", &n);
    for (i=0; i<n; ++i) {
        scanf("%d", &value);
        head = LinkedList_add(head, value);
    }
    scanf("%d", &n);
    for (i=0; i<n; ++i) {
        scanf("%d", &value);
        head = LinkedList_add(head, value);
    }
    
    for (curr=head; curr!=NULL; curr=curr->next) {
        printf("%d", curr->value);
    }
    LinkedList_free(head);

    return 0;
}