#include<bits/stdc++.h>
using namespace std;
int n,t,h[200005];
int s(int cnt){
map<int,int> mp;
for(int i=1; i<=n; i++){
if(h[i]==h[i+1]&&i!=n){
if(mp[h[i]]==0){
cnt++;
if(cnt==1)
cout<<h[i];
else
cout<<' '<<h[i];
mp[h[i]]=1;
}
}
else if(i!=n-1&&h[i]==h[i+2]){
if(mp[h[i]]==0){
cnt++;
if(cnt==1)
cout<<h[i];
else
cout<<' '<<h[i];
mp[h[i]]=1;
}
}
}
return cnt;
}
int main(){
cin>>t;
while(t--){
cin>>n;
for(int i=1; i<=n; i++){
cin>>h[i];
}
if(s(0)==0){
cout<<-1;
}
cout<<endl;
}
return 0;
}