#include <bits/stdc++.h>
using namespace std;
#define int unsigned long long
signed main(){
int T;
cin >> T;
while(T--){
map <int,bool> mp;
int n;
cin >> n;
for(int i=1;i<=n;i++){
int x;
cin >> x;
if(!mp[x]){
cout << x << ' ';
mp[x]=true;
}
}
cout << endl;
}
return 0;
}