rt
#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
long long T,n,b;
unordered_map<int,bool>cnt;
cin>>T;
for(int i=0; i<T; i++) {
cnt.clear();
cin>>b;
for(int i=0; i<b; i++) {
cin>>n;
if(cnt[n]==0) {
cout<<n<<" ";
}
cnt[n]=1;
}
cout<<endl;
}
return 0;
}