#include<bits/stdc++.h>
#define int long long
using namespace std;
auto IN = freopen("permutation.in", "r", stdin);
auto OUT = freopen("permutation.out", "w", stdout);
auto mread = [](){int x;scanf("%lld", &x);return x;};
int t = mread();
int h[100005];
signed main(){
while(t --){
int n = mread();
for(int i = 1; i < n; i ++){
cin >> h[i];
}
if(h[n - 1] != 1){
printf("-1\n");
continue;
}
bool e[n + 5] = {0};
int E = 1;
for(int i = 1; i < n - 1; i ++){
if(e[h[i]]){
E = 0;
break;
}
e[h[i]] = 1;
}
if(E == 0){
printf("-1\n");
continue;
}
int a[n + 5] = {0};
for(int i = 1; i <= n; i ++){
if(e[i] == 0){
if(a[1] == 0){
a[1] = i;
}
else{
a[n] = i;
break;
}
}
}
int l = 1, r = n, ma = 1;
// ma = 0 : the max is on the left
// ma = 1 : the max is on the right
for(int i = 1; i < n - 1; i ++){
if(ma == 0){
l ++;
a[l] = h[i];
}
else{
r --;
a[r] = h[i];
}
if(a[r] > a[l]){
ma = 1;
}
else{
ma = 0;
}
}
for(int i = 1; i <= n; i ++){
printf("%lld ", a[i]);
}
printf("\n");
}
return 0;
}