link
#include<iostream>
#include<algorithm>
#define re register
using namespace std;
const int N = 1e7 + 5;
int T;
int a[N];
bool bucket[N];
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>T;
while(T --){
int n;
cin>>n;
for(re int i = 1;i <= n;i ++){
cin>>a[i];
bucket[a[i]] = true;
}
for(re int i = 1;i <= n;i ++){
if(bucket[a[i]]){
cout<<a[i]<<" ";
bucket[a[i]] = false;
}
}
cout<<"\n";
}
return 0;
}