#include <unordered_set>
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
int T;
cin >> T;
while (T--)
{
int n, a;
unordered_set<int> S;
cin >> n;
while (n--)
{
cin >> a;
if (!S.count(a))
{
cout << a << ' ';
S.insert(a);
}
}
cout << '\n';
}
return 0;
}