#include<algorithm>
#include<cstring>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cmath>
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=2e4+34;
int inf=0x3f3f3f3f;
int idx,cnt,tot;
map<ll,ll>vis;
ll read(){
ll res=0;
char ch=getchar();
while(!isdigit(ch))ch=getchar();
while(isdigit(ch)){
res=res*10+ch-'0';
ch=getchar();
}
return res;
}
void write(ll x){
if(x>=10)write(x/10);
putchar(x%10+'0');
}
void work(){
ll n=read(),x;
vis.clear();
for(int i=1;i<=n;i++){
x=read();
if(vis[x])continue;
write(x);
putchar(' ');
vis[x]++;
}
putchar('\n');
}
int main()
{
int t=1;
t=read();
while(t--)
work();
return 0;
}```