import sys while True: try: n1 = int(input()) L1 = list(map(int, input().split())) n2 = int(input()) L2 = list(map(int, input().split())) # L = [] # #相同的不加入 # for c in L1: # if c not in L: # L.append(c) # for c in L2: # if c not in L: # L.append(c) # L.sort() print("".join(map(str,sorted(list(set(L1 + L2)))))) except: # print(sys.exc_info()) break