#include <iostream>
using namespace std;
typedef struct node
{
int data;
struct node *next;
} st;
int main()
{
int n,m,x;
cin>>n;
while(n--)
{
st *head,*q;
head=new st;
q=head;
head->next=NULL;
int i;
cin>>m;
for(i=0; i<m; i++)
{
cin>>x;
if(i==0)
{
st *p;
p=new st;
p->data=x;
p->next=NULL;
q->next=p;
q=p;
}
else
{
int h=0;
st *w;
for(w=head->next; w!=NULL; w=w->next)
{
if(w->data==x)
{
h=1;
break;
}
}
if(h==0)
{
st *p;
p=new st;
p->data=x;
p->next=NULL;
q->next=p;
q=p;
}
}
}
st *l;
l=head->next;
int g=0;
while(l)
{
if(g==0)
{
cout<<l->data;
g=1;
}
else
{
cout<<" "<<l->data;
}
l=l->next;
}
cout<<endl;
}
}