#include<bits/stdc++.h>
using namespace std;
int a[50005];
map<int, bool> mp;
int main()
{
int t, n;
cin >> t;
for(int i = 1; i <= t; i ++)
{
cin >> n;
for(int j = 1; j <= n; j ++)
{
cin >> a[j];
mp[a[j]] = true;
}
for(int j = 1; j <= n; j ++)
if(mp[a[j]] = true)
{
cout << a[i] << " ";
mp[a[j]] = false;
}
}
return 0;
}