var n1=readline() var str1=readline() var n2=readline() var str2=readline() var arr=str1.split(' ').concat(str2.split(' '))

console.log([...new Set(arr)].sort((a,b)=>{return a-b}).join(''))