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