C. Restoring Permutation

You are given a sequence b1,b2,…,bnb1,b2,…,bn. Find the lexicographically minimal permutation a1,a2,…,a2na1,a2,…,a2n such that bi=min(a2i−1,a2i)bi=min(a2i−1,a2i), or determine that it is impossible.

Input

Each test contains one or more test cases. The first line contains the number of test cases tt (1≤t≤1001≤t≤100).

The first line of each test case consists of one integer nn — the number of elements in the sequence bb (1≤n≤1001≤n≤100).

The second line of each test case consists of nn different integers b1,…,bnb1,…,bn — elements of the sequence bb (1≤bi≤2n1≤bi≤2n).

It is guaranteed that the sum of nn by all test cases doesn't exceed 100100.

Output

For each test case, if there is no appropriate permutation, print one number −1−1.

Otherwise, print 2n2n integers a1,…,a2na1,…,a2n — required lexicographically minimal permutation of numbers from 11 to 2n2n.

Example

input

Copy


5 1 1 2 4 1 3 4 1 3 4 2 3 4 5 5 1 5 7 2 8


output

Copy


1 2 -1 4 5 1 2 3 6 -1 1 3 5 6 7 9 2 4 8 10


题意 :  给一组 长度为 n 的  b[i] , 让你找一组 长度 为 2n 的a[i] , 满足 b[i] = min(a[2*i-1 ]  ,a[2*i] ) ,并且字典序最小 。

思路 : 贪心 

Codeforces Round #623 C. Restoring Permutation_#include

其实就是在左边下面的图中填空,右边空白的要大于左边的数字,并且要先从 左边开始模拟我们填数的过程。

#include <iostream> 
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std ;
typedef long long LL ;
/*

*/
const int MAX = 51000 ;
const int inf = 0x3f3f3f3f ;
/*
给 b1 ,b2 .. bn ;
找字典序最小的 a1 , ... a2n
bi = min(a_2i-1 ,a_2i)


*/
int vis[MAX] ;
int b[MAX] ;
int a[MAX] ;
int main(){
int t ;
cin >> t;
while(t--){
int n ;
cin >>n ;
memset(vis,0,sizeof(vis));
for(int i = 1 ;i<=n ; i++ ) {
cin >>b[i] ;
a[2*i-1] = b[i] ;
vis[b[i]] = 1 ;
}
bool flag = true ;
for(int i = 1 ; i<=n ;i++ ) {
int t = b[i] ;
while(vis[t]){
t++ ;
}

if(t<=2*n) {
a[2*i] = t ;
vis[t] = 1 ;
}
else {
flag = false ;
break ;
}

}
// bool flag = true ;
// for(int i = 1 ;i<=2*n ;i++) {
// if(b[(i+1 )/2] > a[i]){
// flag = false ;
// break ;
// }
// }
if(flag ) {
for(int i = 1 ; i<=2*n ; i++) {
printf("%d ",a[i]);
}
}
else{
printf("-1") ;
}


printf("\n") ;

}


return 0 ;
}