#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<int> a(n),b;
map<int,bool> m;
for(int i=0;i<n;i++){
cin>>a[i];
if(m[a[i]])continue;
b.push_back(a[i]);
m[a[i]]=1;
}
for(auto i:a)cout<<i<<" ";
cout<<endl;
}
return 0;
}