#include<iostream>
#include<unordered_set>
#include<stack>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n;
cin >> n;
unordered_set<int> s;
stack<int> v;
while(n--){
int a;
cin >> a;
s.insert(a);
}
for(auto e:s)v.push(e);
while(!v.empty()){
cout << v.top() << ' ';
v.pop();
}
cout << endl;
}
}