#人生苦短,我用Python
input()#接受无效输入
a=[int(i) for i in input().split()]
input()#接受无效输入
b=[int(i) for i in input().split()]
c=[str(i) for i in sorted(set(a+b))]
print("".join(c))