http://acm.hdu.edu.cn/showproblem.php?pid=1412
/*
2011-9-14
author:BearFly1990
*/
package acm.hdu.tests;
import java.io.BufferedInputStream;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
public class HDU_1412 {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedInputStream(System.in));
Set<Integer> set = new TreeSet<Integer>();
while(in.hasNext()){
set.clear();
Integer n1 = in.nextInt();
Integer n2 = in.nextInt();
for(int i = 0 ; i < n1+n2; i++){
set.add(in.nextInt());
}
int i = 0;
for(Integer it : set){
i++;
if(i == set.size())System.out.println(it);
else System.out.printf("%d ",it);
}
}
}
}