/*
* 题目分析: 1. N个随机数去重; 2. 排序
* 解题思路: 使用 TreeSet 去重及排序
* 注意事项: 题干要求处理多组用例, 使用TreeSet处理完一组用例后需要将TreeSet清空!!!
* 更上一楼: (参考其他答案) 使用数组解决, 用数组下标记录并对数据去重, 最后顺序打印非空数组元素的下标
*/
import java.util.Scanner;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) {
TreeSet<Integer> treeSet = new TreeSet<>();
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int num = sc.nextInt();
for (int i = 0; i < num; i++) {
treeSet.add(sc.nextInt());
}
for (int i: treeSet) {
System.out.println(i);
}
treeSet.clear();
}
}
}