var readline = require("readline");var rl = readline.createInterface({
input:process.stdin,
output:process.stdout
});
var tokens = [];
var currentLine = 1;
function isIn(item, arr){
var isIn = false;
for(var i = 0;i<arr.length;i++){
if(arr[i]===item){
isIn = true;
break;
}
}
return isIn;
}
function order(value1, value2){
return value1-value2;
}
rl.on("line",function(line){
tokens.push(line);
if(currentLine == 3){
var firstLine = tokens[0];
var secondLine = tokens[1];
var thirdLine = tokens[2];
var setOne = secondLine.split(" ").map(function(item,index,arr){
return parseInt(item.trim());
});
var setTwo = thirdLine.split(" ").map(function(item,index,arr){
return parseInt(item.trim());
});
var res = [].concat(setOne);
for(var i=0; i<setTwo.length;i++){
if(!isIn(setTwo[i],setOne)){
res.push(setTwo[i]);
}
}
console.log(res.sort(order).join(" "));
}else{
currentLine++;
}
});