while True:
try:
a = input()
b = map(int,input().split())
c = input()
d = map(int,input().split())
e = []
#找到不重复的元素,放入空数组
for i in b:
if i not in e:
e.append(i)
for i in d:
if i not in e:
e.append(i)
#升序排列,无连接符
print(''.join(map(str,sorted(e))))
except:
break