while True:
    try:
        a = int(input())
        b = input().split()
        c = int(input())
        d = input().split()
        n = sorted(map(int,set(b + d)))
        for i in n:
            print(i, end="")
    except:
        break