#include<bits/stdc++.h>
using namespace std;
struct hash
{
bool hid[100000]={false};
void ins(int x)
{
hid[x%999983]=true;
}
bool ask(int x)
{
if(hid[x%999983]) return true;
return false;
}
void del(int x)
{
hid[x%999983]=false;
}
}a;
int main()
{
int n,time;
int b[100010];
cin>>n;
while(n--)
{
cin>>time;
for(int i=0;i<time;i++)
{
scanf("%d",&b[i]);
a.ins(b[i]);
}
for(int i=0;i<time;i++)
{
if(a.ask(b[i]))
{
printf("%d ",b[i]);
a.del(b[i]);
}
}
cout<<endl;
}
return 0;
}