#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
const int maxn = 1e+5 + 3;
int t,n;
vector< vector<int> > h(maxn+10);
bool h_find(int a){
int haxi = a%maxn;
if(haxi<0){
haxi*=-1;
}
haxi+=1;
for(int i=0;i<h[haxi].size();i++){
if(h[haxi][i]==a){
return true;
}
}
return false;
}
void h_insert(int a){
int haxi = a%maxn;
if(haxi<0){
haxi*=-1;
}
haxi+=1;
h[haxi].push_back(a);
}
int main(){
std::ios::sync_with_stdio(false);
cin>>t;
do{
for(int i=0;i<=h.size();i++){
for(int j=0;j<h[i].size();j++){
h[i][j]=0;
}
}
cin>>n;
int x=0;
for(int i=1;i<=n;++i){
cin>>x;
if(h_find(x)==false){
cout<<x<<' ';
h_insert(x);
// for(int i=1;i<=h[haxi].size();i++){
// cout<<h[haxi][i]<<' ';
// }
}
}
cout<<endl;
}while(--t);
return 0;
}
/*
第一行一个整数 T,表示数据组数。
对于每组数据:
第一行一个整数 n。
第二行 n 个数,表示给定的数。
*/
Orz