#include <iostream>
#include <cstring>
using namespace std;
const int N = 2e5 + 3;
struct Node
{
int el = 0;
int af = 0;
}Hash[N];
int head[N];
int id;
void init()
{
memset(Hash, 0x00, sizeof Hash);
memset(head, 0x00, sizeof head);
id = 0;
}
int HashFun(int x)
{
return (x % N + N) % N;
}
void insert(int x)
{
int idx = HashFun(x);
Hash[++id].el = x;
Hash[id].af = head[idx];
head[idx] = id;
}
bool find(int x)
{
int idx = HashFun(x);
for(int sp = head[idx]; sp; sp = Hash[sp].af)
{
if(Hash[sp].el == x) return true;
}
return false;
}
int main()
{
int T = 0; cin >> T;
while(T--)
{
init();
int n = 0; cin >> n;
while(n--)
{
int num = 0; cin >> num;
if(!find(num))
{
insert(num);
cout << num << ' ';
}
}
cout << endl;
}
return 0;
}