#include<bits/stdc++.h>
using namespace std;

int main()
{
    int one,two;
    while( ~scanf("%d",&one) )
    {
        set<int> solve;
        int temp;
        int loop=one;
        while( loop-- )
        {
            scanf("%d",&temp);
            solve.insert( temp );
        }

        scanf("%d",&two);
        loop=two;
        while( loop-- )
        {
            scanf("%d",&temp);
            solve.insert( temp );
        }

        for( auto num : solve )
        {
            printf("%d", num );
        }
        printf("\n");
    }

    //system("pause");
    return 0;
}