let str;
while(str = readline()){
  let res = [];
  let arr1 = readline().split(' ');
  readline();
  let arr2 = readline().split(' ');

  let all = arr1.concat(arr2);
  for(let v of new Set(all)){
    res.push(v)
  }

  console.log(res.sort((a,b)=>{return a-b}).join(''))
}