#include <iostream>
#include <vector>

using namespace std;

int main () {
    int test;
    cin >> test;
    for(int t = 0; t < test; t++) {
        int tmp;
        cin >> tmp;
        vector<int> numbers(tmp);
        vector<int> results(tmp);
        int booot = 0;
        for(int index = 0; index < tmp; index++) {
            cin >> numbers[index];
            if(numbers[index] < booot)
                booot = -1;
            booot = numbers[index];
        }
        if(booot == -1) {
            cout << -1 << endl;
            continue;
        }
        vector<bool> shalgah(tmp + 1, 0);
        int utilize = 1;
        results[0] = numbers[0];
        shalgah[results[0]] = 1;
        if(utilize == results[0])
            utilize ++;
        int index = 1;
        for(index = 1; index < tmp; index++) {
            if(numbers[index] > numbers[index - 1]) {
                results[index] = numbers[index];
                shalgah[results[index]] = 1;
            } else {
                while(shalgah[utilize] && utilize <= numbers[index]) {
                    utilize ++;
                }
                if(utilize > numbers[index]) {
                    cout << -1 << endl;
                    break;
                }
                results[index] = utilize;
                shalgah[utilize] = 1;
                utilize++;
            }
        }
        if(index != tmp)
            continue;
        for(int i = 0; i < tmp; i++)
            cout << results[i] << " ";
        cout << endl;
        }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main () {
    int test;

    cin >> test;

    while (test > 0) {
        int p;
        cin >> p;
        vector<int> numbers(p);
        vector<int> results(p);
        int booot = 0;
        for(int i = 0; i < p; i++) {
            cin >> numbers[i];
            if(numbers[i] < booot)
                booot = -1;
            booot = numbers[i];
        }
        if(booot == -1) {
            cout << -1 << endl;
            continue;
        }
        vector<bool> shalgah(p + 1, 0);
        int utilize = 1;
        results[0] = numbers[0];
        shalgah[results[0]] = 1;
        if(utilize == results[0])
            utilize ++;
        for(int i = 1; i < p; i++) {
            if(numbers[i] > numbers[i - 1]) {
                results[i] = numbers[i];
                shalgah[results[i]] = 1;
            } else {
                while(shalgah[utilize] && utilize <= numbers[i]) {
                    utilize ++;
                }
                if(utilize > numbers[i]) {
                    cout << -1 << endl;
                    continue;
                }
                results[i] = utilize;
                shalgah[utilize] = 1;
                utilize++;
            }
        }
        for(int i = 0; i < p; i++) {
            cout << results[i] << " ";
        }
        cout << endl;
        test--;
        }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main () {
    int test;
    cin >> test;
    while (test > 0) {
        int tmp;
        cin >> tmp;
        vector<int> numbers(tmp);
        vector<int> results(tmp);
        int booot = 0;
        for(int index = 0; index < tmp; index++) {
            cin >> numbers[index];
            if(numbers[index] < booot)
                booot = -1;
            booot = numbers[index];
        }
        if(booot == -1) {
            cout << -1 << endl;
            continue;
        }
        vector<bool> shalgah(tmp + 1, 0);
        int utilize = 1;
        results[0] = numbers[0];
        shalgah[results[0]] = 1;
        if(utilize == results[0])
            utilize ++;
        int index = 1;
        for(index = 1; index < tmp; index++) {
            if(numbers[index] > numbers[index - 1]) {
                results[index] = numbers[index];
                shalgah[results[index]] = 1;
            } else {
                while(shalgah[utilize] && utilize <= numbers[index]) {
                    utilize ++;
                }
                if(utilize > numbers[index]) {
                    cout << -1 << endl;
                    continue;
                }
                results[index] = utilize;
                shalgah[utilize] = 1;
                utilize++;
            }
        }
        if(index != tmp)
            continue;
        for(int i = 0; i < tmp; i++)
            cout << results[i] << " ";
        cout << endl;
        test--;
        }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main () {
    int test;

    cin >> test;

    while (test > 0) {
        int p;
        cin >> p;
        vector<int> numbers(p);
        vector<int> results(p);
        int booot = 0;
        for(int i = 0; i < p; i++) {
            cin >> numbers[i];
            if(numbers[i] < booot)
                booot = -1;
            booot = numbers[i];
        }
        if(booot == -1) {
            cout << -1 << endl;
            continue;
        }
        vector<bool> shalgah(p + 1, 0);
        int utilize = 1;
        results[0] = numbers[0];
        shalgah[results[0]] = 1;
        if(utilize == results[0])
            utilize ++;
        for(int i = 1; i < p; i++) {
            if(numbers[i] > numbers[i - 1]) {
                results[i] = numbers[i];
                shalgah[results[i]] = 1;
            } else {
                while(shalgah[utilize] && utilize <= numbers[i]) {
                    utilize ++;
                }
                if(utilize > numbers[i]) {
                    cout << -1 << endl;
                    break;
                }
                results[i] = utilize;
                shalgah[utilize] = 1;
                utilize++;
            }
        }
        for(int i = 0; i < p; i++) {
            cout << results[i] << " ";
        }
        cout << endl;
        test--;
        }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main () {
    int test;

    cin >> test;

    while (test > 0) {
        int p;
        cin >> p;
        vector<int> numbers(p);
        vector<int> results(p);
        int booot = 0;
        for(int i = 0; i < p; i++) {
            cin >> numbers[i];
            if(numbers[i] < booot)
                booot = -1;
            booot = numbers[i];
        }
        if(booot == -1) {
            cout << -1 << endl;
            return;
        }
        vector<bool> shalgah(p + 1, 0);
        int utilize = 1;
        results[0] = numbers[0];
        shalgah[results[0]] = 1;
        if(utilize == results[0])
            utilize ++;
        for(int i = 1; i < p; i++) {
            if(numbers[i] > numbers[i - 1]) {
                results[i] = numbers[i];
                shalgah[results[i]] = 1;
            } else {
                while(shalgah[utilize] && utilize <= numbers[i]) {
                    utilize ++;
                }
                if(utilize > numbers[i]) {
                    cout << -1 << endl;
                    return;
                }
                results[i] = utilize;
                shalgah[utilize] = 1;
                utilize++;
            }
        }
        for(int i = 0; i < p; i++) {
            cout << results[i] << " ";
        }
        cout << endl;
        test--;
        }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main () {
    int test;

    cin >> test;

    while (test > 0) {
        int tmp;
        cin >> tmp;
        vector<int> numbers(tmp);
        vector<int> results(tmp);
        int booot = 0;
        for(int index = 0; index < tmp; index++) {
            cin >> numbers[index];
            if(numbers[index] < booot)
                booot = -1;
            booot = numbers[index];
        }
        if(booot == -1) {
            cout << -1 << endl;
            continue;
        }
        vector<bool> shalgah(tmp + 1, 0);
        int utilize = 1;
        results[0] = numbers[0];
        shalgah[results[0]] = 1;
        if(utilize == results[0])
            utilize ++;
        int index = 1;
        for(int index = 1; index < tmp; index++) {
            if(numbers[index] > numbers[index - 1]) {
                results[index] = numbers[index];
                shalgah[results[index]] = 1;
            } else {
                while(shalgah[utilize] && utilize <= numbers[index]) {
                    utilize ++;
                }
                if(utilize > numbers[index]) {
                    cout << -1 << endl;
                    break;
                }
                results[index] = utilize;
                shalgah[utilize] = 1;
                utilize++;
            }
        }
        if(index != tmp)
            continue;
        for(int index = 0; index < tmp; index++) {
            cout << results[index] << " ";
        }
        cout << endl;
        test--;
        }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main () {
    int test;

    cin >> test;

    while (test > 0) {
        int tmp;
        cin >> tmp;
        vector<int> numbers(tmp);
        vector<int> results(tmp);
        int booot = 0;
        for(int index = 0; index < tmp; index++) {
            cin >> numbers[index];
            if(numbers[index] < booot)
                booot = -1;
            booot = numbers[index];
        }
        if(booot == -1) {
            cout << -1 << endl;
            continue;
        }
        vector<bool> shalgah(tmp + 1, 0);
        int utilize = 1;
        results[0] = numbers[0];
        shalgah[results[0]] = 1;
        if(utilize == results[0])
            utilize ++;
        int index = 1;
        for(index = 1; index < tmp; index++) {
            if(numbers[index] > numbers[index - 1]) {
                results[index] = numbers[index];
                shalgah[results[index]] = 1;
            } else {
                while(shalgah[utilize] && utilize <= numbers[index]) {
                    utilize ++;
                }
                if(utilize > numbers[index]) {
                    cout << -1 << endl;
                    break;
                }
                results[index] = utilize;
                shalgah[utilize] = 1;
                utilize++;
            }
        }
        if(index != tmp)
            continue;
        for(int index = 0; index < tmp; index++) {
            cout << results[index] << " ";
        }
        cout << endl;
        test--;
        }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long n, t, p[100007], q[100007], used[100007];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> t;
     for (long long i=1; i<=t; i++){
            cin >> n;
            long long err=0;
             for (long long j=1; j<=n; j++){
                cin >> q[j];
                if (err!=0)continue;
                used[ q[j] ]=0;
                if (q[j]>q[j-1]){used[ q[j] ]=1; p[j]=q[j];continue;}
                long long k=0;
                for (long long x=1; x<q[j]; x++){
                    if (used[x]==0){
                        used[x]=1;
                        p[j]=x;
                        k++;
                        break;
                    }
                }
                if (k==0)err++;
            }
            if (err!=0){cout << -1 << endl;continue;}
            for (long long j=1; j<=n; j++){
                cout << p[j] << " ";
            }
            cout << endl;
     }
 return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n,t;
    cin >> t;
    while (t--)
    {
        long long pl=0;
        cin >> n;
        long long q[n+1], p[n+1], used[n+1]= {0};
        q[0]=0;
        long long err=0;
        for (long long i=1; i<=n; i++)
        {
            cin >> q[i];
            long long k=0;
            if (err!=0)continue;
            if (q[i]>q[i-1])
            {
                //if (used [ q[i] ]==1){err++; continue;}
                p[i]=q[i];
                used[ q[i] ] = 1;
                continue;
            }
            pl=0;
check:
            pl++;
            if (pl>=q[i])goto eror;
            if (used[ q[i]-pl ]==0)
            {
                used[ q[i]-pl ]=1;
                p[i] = q[i]-pl;
                k++;
            }
            else goto check;
eror:
            if (k==0)err++;
        }

        if (err!=0)
        {
            cout << -1 ;
        }
        else
        {
            for (long long i=1; i<=n; i++)
            {
                cout << p[i] << " ";
            }
        }
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n,t;
    cin >> t;
    while (t--)
    {
        //long long pl=0;
        cin >> n;
        long long q[n+1], p[n+1], used[n+1]= {0}, pl[n+1]={0};
        q[0]=0;
        long long err=0;
        for (long long i=1; i<=n; i++)
        {
            cin >> q[i];
            long long k=0;
            if (err!=0)continue;
            if (q[i]>q[i-1])
            {
                //if (used [ q[i] ]==1){err++; continue;}
                p[i]=q[i];
                used[ q[i] ] = 1;
                continue;
            }
            //pl=0;
check:
            pl[ q[i] ]++;
            if (pl [ q[i] ]>=q[i])goto eror;
            if (used[ q[i]-pl[ q[i] ] ]==0)
            {
                used[ q[i]-pl[ q[i] ] ]=1;
                p[i] = q[i]-pl[ q[i] ];
                k++;
            }
            else goto check;
eror:
            if (k==0)err++;
        }

        if (err!=0)
        {
            cout << -1 ;
        }
        else
        {
            for (long long i=1; i<=n; i++)
            {
                cout << p[i] << " ";
            }
        }
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long n, t, p[100007], q[100007], used[100007];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> t;
     for (long long i=1; i<=t; i++){
            cin >> n;
            long long err=0;
             for (long long j=1; j<=n; j++){
                cin >> q[j];
                if (err!=0)continue;
                if (q[j]>q[j-1]){used[ q[j] ]=1; p[j]=q[j];continue;}
                long long k=0;
                for (long long x=1; x<q[j]; x++){
                    if (used[x]==0){
                        used[x]=1;
                        p[j]=x;
                        k++;
                        break;
                    }
                }
                if (k==0)err++;
            }
            if (err!=0){
                for (long long j=1; j<=n; j++){
                    used[ q[j] ]=0;
                }
                cout << -1 << endl;
                continue;
            }
            for (long long j=1; j<=n; j++){
                cout << p[j] << " ";
                used[ p[j] ]=0;
            }
            cout << endl;
     }
 return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n,t;
    cin >> t;
     while (t--){
        long long pl=0;
        cin >> n;
        long long q[n+1], p[n+1], used[n+1]={0};
        long long err=0;
         for (long long i=1; i<=n; i++){
            cin >> q[i];
            long long k=0;
            if (err!=0)continue;
            if (q[i]>q[i-1]){
                //if (used [ q[i] ]==1){err++; continue;}
                 p[i]=q[i];
                 used[ q[i] ] = 1;
                 continue;
            }
check:
            if (pl>=q[i])goto eror;
            pl++;
            if (used[ q[i]-pl+1 ]==0){
                used[ q[i]-pl+1 ]=1;
                p[i] = q[i]-pl+1;
                k++;
            }else goto check;
eror:
            if (k==0)err++;
         }

         if (err!=0){cout << -1 ;}
         else{
            for (long long i=1; i<=n; i++){
                cout << p[i] << " ";
            }
         }
          cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long n, t, p[100007], q[100007], used[100007];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> t;
     for (long long i=1; i<=t; i++){
            cin >> n;
            long long err=0;
             for (long long j=1; j<=n; j++){
                cin >> q[j];
                if (err!=0)continue;
                if (q[j]>q[j-1]){used[ q[j] ]=1; p[j]=q[j];continue;}
                long long k=0;
                for (long long x=1; x<=q[j]; x++){
                    if (used[x]==0){
                        used[x]=1;
                        p[j]=x;
                        k++;
                        break;
                    }
                }
                if (k==0)err++;
            }
            if (err!=0){
                for (long long j=1; j<=n; j++){
                    used[ q[j] ]=0;
                }
                cout << -1 << endl;
                continue;
            }
            for (long long j=1; j<=n; j++){
                cout << p[j] << " ";
                used[ p[j] ]=0;
            }
            cout << endl;
     }
 return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long t, n, q[100007], p[100007], used[100007];

int main()
{
    cin >> t;
     while (t--){
        cin >> n;
        long long err=0;
         for (long long i=1; i<=n; i++){
            cin >> q[i];
            long long k=0;
            if (err!=0)continue;
            if (q[i]>q[i-1]){
                //if (used [ q[i] ]==1){err++; continue;}
                 p[i]=q[i];
                 used[ q[i] ] = 1;
                 continue;
            }

            for (long long j=1; j<q[i]; j++){
                if (used[j]==0){
                    used[j]=1;
                    p[i]=j;
                    k++;
                    break;
                }
            }

            if (k==0)err++;
         }

         for (long long i=1; i<=n; i++){
            used[ i ]=0;
            if (err==0){cout << p[i] << " ";}
                //cout << used[ p [i] ] << " ";
         }
         /*for (long long i=1; i<=n; i++){
            cout << p[i] << " " << used[ p[i] ];
         }*/
         if (err!=0)cout << -1;
         cout << endl;
     }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long t, n, q[100007], p[100007], used[100007];

int main()
{
    cin >> t;
     while (t--){
        cin >> n;
        long long err=0;
         for (long long i=1; i<=n; i++){
            cin >> q[i];
            long long k=0;
            if (err!=0)continue;
            if (q[i]>q[i-1]){
                //if (used [ q[i] ]==1){err++; continue;}
                 p[i]=q[i];
                 used[ q[i] ] = 1;
                 continue;
            }

            for (long long j=1; j<q[i]; j++){
                if (used[j]==0){
                    used[j]=1;
                    p[i]=j;
                    k++;
                    break;
                }
            }

            if (k==0)err++;
         }

         for (long long i=1; i<=n; i++){
            used[ q[i] ]=0;
            if (err==0){cout << p[i] << " ";}
         }
         if (err!=0)cout << -1;
         cout << endl;
     }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n,t;
    cin >> t;
    while (t--)
    {
        //long long pl=0;
        cin >> n;
        queue < long long > qu;
        long long q[n+1], p[n+1], used[n+1]= {0}, pl[n+1]={0};
        q[0]=0;
        long long err=0;
        for (long long i=1; i<=n; i++){
            cin >> q[i];
            qu.push(i);
        }

          used [ q[1] ] =1;
          p[1]=q[1];

          for (long long i=1; i<=n; i++){

            if (q[i]>q[i-1]){
                used[ q[i] ]=1;
                p[i]=q[i];
                continue;
            }

            while (qu.size()>0 && used[qu.front()]==1)qu.pop();

            if (qu.size()>0 && qu.front()<q[i]){
                p[i]=qu.front();
                used[qu.front()]=1;
            }else{
              err++;
              break;
            }

          }

        if (err!=0){
            cout << -1 ;
        }else{
            for (long long i=1; i<=n; i++){
                cout << p[i] << " ";
            }
        }
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long n,t;
    cin >> t;
    while (t--)
    {
        long long pl=0;
        cin >> n;
        long long q[n+1], p[n+1], used[n+1]= {0};
        q[0]=0;
        long long err=0;
        for (long long i=1; i<=n; i++)
        {
            cin >> q[i];
            long long k=0;
            if (err!=0)continue;
            if (q[i]>q[i-1])
            {
                //if (used [ q[i] ]==1){err++; continue;}
                p[i]=q[i];
                used[ q[i] ] = 1;
                continue;
            }
check:
            if (pl>=q[i])goto eror;
            pl++;
            if (used[ q[i]-pl+1 ]==0)
            {
                used[ q[i]-pl+1 ]=1;
                p[i] = q[i]-pl+1;
                k++;
            }
            else goto check;
eror:
            if (k==0)err++;
        }

        if (err!=0)
        {
            cout << -1 ;
        }
        else
        {
            for (long long i=1; i<=n; i++)
            {
                cout << p[i] << " ";
            }
        }
        cout << endl;
    }
    return 0;
}


 // #include <iostream>
#include <bits/stdc++.h>
/*#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>*/
#define ll long long
#define dl double
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define unique(a)       sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Assert(x)       {if(!(x)){cerr<<"Assertion failed at line "<<__LINE__<<": "<<#x<<" = "<<(x)<<"\n";exit(1);}}
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define mod 1000000007

using namespace std;

typedef long long LL;
   bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}
// A utility function to get the middle index from corner indexes.

/*  A recursive function to get the xor of values in given range
    of the array. The following are parameters for this function.

    st    --> Pointer to segment tree
    si    --> Index of current node in the segment tree. Initially
              0 is passed as root is always at index 0
    ss & se  --> Starting and ending indexes of the segment
                 represented by current node, i.e., st[si]
    qs & qe  --> Starting and ending indexes of query range */

/* A recursive function to update the nodes which have the given
   index in their range. The following are parameters
    st, si, ss and se are same as getXorUtil()
    i    --> index of the element to be updated. This index is
             in input array.
   diff --> Value to be added to all nodes which have i in range */

//     bool prime[1000010];
// void SieveOfEratosthenes(int n)
// {
//     // Create a boolean array "prime[0..n]" and initialize
//     // all entries it as true. A value in prime[i] will
//     // finally be false if i is Not a prime, else true.

//     memset(prime, true, sizeof(prime));

//     for (int p=2; p*p<=n; p++)
//     {
//         // If prime[p] is not changed, then it is a prime
//         if (prime[p] == true)
//         {
//             // Update all multiples of p greater than or
//             // equal to the square of it
//             // numbers which are multiple of p and are
//             // less than p^2 are already been marked.
//             for (int i=p*p; i<=n; i += p)
//                 prime[i] = false;
//         }
//     }

//     // Print all prime numbers
//     // for (int p=2; p<=n; p++)
//        // if (prime[p])
//        //    cout << p << " ";
// }

// The function to update a value in input array and segment tree.
// It uses updateValueUtil() to update the value in segment tree

const long long MAX_SIZE = 1000001;

// isPrime[] : isPrime[i] is true if number is prime
// prime[] : stores all prime number less than N
// SPF[] that store smallest prime factor of number
// [for Exp : smallest prime factor of '8' and '16'
// is '2' so we put SPF[8] = 2 , SPF[16] = 2 ]
vector<long long >isprime(MAX_SIZE , true);
vector<long long >prime;
vector<long long >SPF(MAX_SIZE);

// function generate all prime number less then N in O(n)
void manipulated_seive(int N)
{
    // 0 and 1 are not prime
    isprime[0] = isprime[1] = false ;

    // Fill rest of the entries
    for (long long int i=2; i<N ; i++)
    {
        // If isPrime[i] == True then i is
        // prime number
        if (isprime[i])
        {
            // put i into prime[] vector
            prime.push_back(i);

            // A prime number is its own smallest
            // prime factor
            SPF[i] = i;
        }

        // Remove all multiples of  i*prime[j] which are
        // not prime by making isPrime[i*prime[j]] = false
        // and put smallest prime factor of i*Prime[j] as prime[j]
        // [ for exp :let  i = 5 , j = 0 , prime[j] = 2 [ i*prime[j] = 10 ]
        // so smallest prime factor of '10' is '2' that is prime[j] ]
        // this loop run only one time for number which are not prime
        for (long long int j=0;
             j < (int)prime.size() &&
             i*prime[j] < N && prime[j] <= SPF[i];
             j++)
        {
            isprime[i*prime[j]]=false;

            // put smallest prime factor of i*prime[j]
            SPF[i*prime[j]] = prime[j] ;
        }
    }
}

ll power(ll x,ll y,ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res%p;
}

int main()
{
    ll i,j,n,m,a,b,t;

    cin>>t;

    while(t--)
    {
        cin>>n;
        ll ar[n],ans[n];

        for(i=0;i<n;i++)
        {
            cin>>ar[i];
        }

        unordered_map<ll,ll> mp;
        ans[0] = ar[0];
        mp[ar[0]] = 1;
        ll temp;

        if(ar[0] != 1)
        {
            temp = 1;
        }
        else
            temp = 2;

        ll flag = 1;
        for(i=1;i<n;i++)
        {
            if(ar[i] == ar[i-1] && temp < ar[i])
            {
                ans[i] = temp;
                mp[temp] = 1;
                temp++;
                while(mp[temp] == 1)
                {
                    temp++;
                }
            }
            else if(ar[i] == ar[i-1] && temp >= ar[i])
            {
                flag = 0;
                break;
            }
            else
            {
                ans[i] = ar[i];
            }
        }

        if(flag == 0)
            cout<<"-1\n";
        else
        {
            for(i=0;i<n;i++)
                cout<<ans[i]<<" ";
            cout<<"\n";
        }

    }
    return 0;
}


 // #include <iostream>
#include <bits/stdc++.h>
/*#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>*/
#define ll long long
#define dl double
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define unique(a)       sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Assert(x)       {if(!(x)){cerr<<"Assertion failed at line "<<__LINE__<<": "<<#x<<" = "<<(x)<<"\n";exit(1);}}
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define mod 1000000007

using namespace std;

typedef long long LL;
   bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}
// A utility function to get the middle index from corner indexes.

/*  A recursive function to get the xor of values in given range
    of the array. The following are parameters for this function.

    st    --> Pointer to segment tree
    si    --> Index of current node in the segment tree. Initially
              0 is passed as root is always at index 0
    ss & se  --> Starting and ending indexes of the segment
                 represented by current node, i.e., st[si]
    qs & qe  --> Starting and ending indexes of query range */

/* A recursive function to update the nodes which have the given
   index in their range. The following are parameters
    st, si, ss and se are same as getXorUtil()
    i    --> index of the element to be updated. This index is
             in input array.
   diff --> Value to be added to all nodes which have i in range */

//     bool prime[1000010];
// void SieveOfEratosthenes(int n)
// {
//     // Create a boolean array "prime[0..n]" and initialize
//     // all entries it as true. A value in prime[i] will
//     // finally be false if i is Not a prime, else true.

//     memset(prime, true, sizeof(prime));

//     for (int p=2; p*p<=n; p++)
//     {
//         // If prime[p] is not changed, then it is a prime
//         if (prime[p] == true)
//         {
//             // Update all multiples of p greater than or
//             // equal to the square of it
//             // numbers which are multiple of p and are
//             // less than p^2 are already been marked.
//             for (int i=p*p; i<=n; i += p)
//                 prime[i] = false;
//         }
//     }

//     // Print all prime numbers
//     // for (int p=2; p<=n; p++)
//        // if (prime[p])
//        //    cout << p << " ";
// }

// The function to update a value in input array and segment tree.
// It uses updateValueUtil() to update the value in segment tree

const long long MAX_SIZE = 1000001;

// isPrime[] : isPrime[i] is true if number is prime
// prime[] : stores all prime number less than N
// SPF[] that store smallest prime factor of number
// [for Exp : smallest prime factor of '8' and '16'
// is '2' so we put SPF[8] = 2 , SPF[16] = 2 ]
vector<long long >isprime(MAX_SIZE , true);
vector<long long >prime;
vector<long long >SPF(MAX_SIZE);

// function generate all prime number less then N in O(n)
void manipulated_seive(int N)
{
    // 0 and 1 are not prime
    isprime[0] = isprime[1] = false ;

    // Fill rest of the entries
    for (long long int i=2; i<N ; i++)
    {
        // If isPrime[i] == True then i is
        // prime number
        if (isprime[i])
        {
            // put i into prime[] vector
            prime.push_back(i);

            // A prime number is its own smallest
            // prime factor
            SPF[i] = i;
        }

        // Remove all multiples of  i*prime[j] which are
        // not prime by making isPrime[i*prime[j]] = false
        // and put smallest prime factor of i*Prime[j] as prime[j]
        // [ for exp :let  i = 5 , j = 0 , prime[j] = 2 [ i*prime[j] = 10 ]
        // so smallest prime factor of '10' is '2' that is prime[j] ]
        // this loop run only one time for number which are not prime
        for (long long int j=0;
             j < (int)prime.size() &&
             i*prime[j] < N && prime[j] <= SPF[i];
             j++)
        {
            isprime[i*prime[j]]=false;

            // put smallest prime factor of i*prime[j]
            SPF[i*prime[j]] = prime[j] ;
        }
    }
}

ll power(ll x,ll y,ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res%p;
}

int main()
{
    ll i,j,n,m,a,b,t;

    cin>>t;

    while(t--)
    {
        cin>>n;
        ll ar[n],ans[n];

        for(i=0;i<n;i++)
        {
            cin>>ar[i];
        }

        unordered_map<ll,ll> mp;
        ans[0] = ar[0];
        mp[ar[0]] = 1;
        ll temp;

        if(ar[0] != 1)
        {
            temp = 1;
        }
        else
            temp = 2;

        ll flag = 1;
        for(i=1;i<n;i++)
        {
            if(ar[i] == ar[i-1] && temp < ar[i])
            {
                ans[i] = temp;
                mp[temp] = 1;
                temp++;
                while(mp[temp] == 1)
                {
                    temp++;
                }
            }
            else if(ar[i] == ar[i-1] && temp >= ar[i])
            {
                flag = 0;
                break;
            }
            else
            {
                ans[i] = ar[i];
                mp[ar[i]] = 1;
                while(mp[temp] == 1)
                {
                    temp++;
                }
            }
        }

        if(flag == 0)
            cout<<"-1\n";
        else
        {
            for(i=0;i<n;i++)
                cout<<ans[i]<<" ";
            cout<<"\n";
        }

    }
    return 0;
}


 // #include <iostream>
#include <bits/stdc++.h>
/*#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>*/
#define ll long long
#define dl double
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define unique(a)       sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Assert(x)       {if(!(x)){cerr<<"Assertion failed at line "<<__LINE__<<": "<<#x<<" = "<<(x)<<"\n";exit(1);}}
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define mod 1000000007

using namespace std;

typedef long long LL;
   bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}
// A utility function to get the middle index from corner indexes.

/*  A recursive function to get the xor of values in given range
    of the array. The following are parameters for this function.

    st    --> Pointer to segment tree
    si    --> Index of current node in the segment tree. Initially
              0 is passed as root is always at index 0
    ss & se  --> Starting and ending indexes of the segment
                 represented by current node, i.e., st[si]
    qs & qe  --> Starting and ending indexes of query range */

/* A recursive function to update the nodes which have the given
   index in their range. The following are parameters
    st, si, ss and se are same as getXorUtil()
    i    --> index of the element to be updated. This index is
             in input array.
   diff --> Value to be added to all nodes which have i in range */

//     bool prime[1000010];
// void SieveOfEratosthenes(int n)
// {
//     // Create a boolean array "prime[0..n]" and initialize
//     // all entries it as true. A value in prime[i] will
//     // finally be false if i is Not a prime, else true.

//     memset(prime, true, sizeof(prime));

//     for (int p=2; p*p<=n; p++)
//     {
//         // If prime[p] is not changed, then it is a prime
//         if (prime[p] == true)
//         {
//             // Update all multiples of p greater than or
//             // equal to the square of it
//             // numbers which are multiple of p and are
//             // less than p^2 are already been marked.
//             for (int i=p*p; i<=n; i += p)
//                 prime[i] = false;
//         }
//     }

//     // Print all prime numbers
//     // for (int p=2; p<=n; p++)
//        // if (prime[p])
//        //    cout << p << " ";
// }

// The function to update a value in input array and segment tree.
// It uses updateValueUtil() to update the value in segment tree

const long long MAX_SIZE = 1000001;

// isPrime[] : isPrime[i] is true if number is prime
// prime[] : stores all prime number less than N
// SPF[] that store smallest prime factor of number
// [for Exp : smallest prime factor of '8' and '16'
// is '2' so we put SPF[8] = 2 , SPF[16] = 2 ]
vector<long long >isprime(MAX_SIZE , true);
vector<long long >prime;
vector<long long >SPF(MAX_SIZE);

// function generate all prime number less then N in O(n)
void manipulated_seive(int N)
{
    // 0 and 1 are not prime
    isprime[0] = isprime[1] = false ;

    // Fill rest of the entries
    for (long long int i=2; i<N ; i++)
    {
        // If isPrime[i] == True then i is
        // prime number
        if (isprime[i])
        {
            // put i into prime[] vector
            prime.push_back(i);

            // A prime number is its own smallest
            // prime factor
            SPF[i] = i;
        }

        // Remove all multiples of  i*prime[j] which are
        // not prime by making isPrime[i*prime[j]] = false
        // and put smallest prime factor of i*Prime[j] as prime[j]
        // [ for exp :let  i = 5 , j = 0 , prime[j] = 2 [ i*prime[j] = 10 ]
        // so smallest prime factor of '10' is '2' that is prime[j] ]
        // this loop run only one time for number which are not prime
        for (long long int j=0;
             j < (int)prime.size() &&
             i*prime[j] < N && prime[j] <= SPF[i];
             j++)
        {
            isprime[i*prime[j]]=false;

            // put smallest prime factor of i*prime[j]
            SPF[i*prime[j]] = prime[j] ;
        }
    }
}

ll power(ll x,ll y,ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res%p;
}

int main()
{
    ll i,j,n,m,a,b,t;

    cin>>t;

    while(t--)
    {
        cin>>n;
        ll ar[n],ans[n];

        for(i=0;i<n;i++)
        {
            cin>>ar[i];
        }
        ans[0] = ar[0];
        ll temp;

        if(ar[0] != 1)
        {
            temp = 1;
        }
        else
            temp = 2;

        ll flag = 1;
        for(i=1;i<n;i++)
        {
            if(ar[i] == ar[i-1] && temp < ar[i])
            {
                ans[i] = temp;
                temp++;
            }
            else if(ar[i] == ar[i-1] && temp >= ar[i])
            {
                flag = 0;
                break;
            }
            else
            {
                ans[i] = ar[i];
            }
        }

        if(flag == 0)
            cout<<"-1\n";
        else
        {
            for(i=0;i<n;i++)
                cout<<ans[i]<<" ";
            cout<<"\n";
        }

    }
    return 0;
}


 // #include <iostream>
#include <bits/stdc++.h>
/*#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>*/
#define ll long long
#define dl double
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define unique(a)       sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Assert(x)       {if(!(x)){cerr<<"Assertion failed at line "<<__LINE__<<": "<<#x<<" = "<<(x)<<"\n";exit(1);}}
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define mod 1000000007

using namespace std;

typedef long long LL;
   bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}
// A utility function to get the middle index from corner indexes.

/*  A recursive function to get the xor of values in given range
    of the array. The following are parameters for this function.

    st    --> Pointer to segment tree
    si    --> Index of current node in the segment tree. Initially
              0 is passed as root is always at index 0
    ss & se  --> Starting and ending indexes of the segment
                 represented by current node, i.e., st[si]
    qs & qe  --> Starting and ending indexes of query range */

/* A recursive function to update the nodes which have the given
   index in their range. The following are parameters
    st, si, ss and se are same as getXorUtil()
    i    --> index of the element to be updated. This index is
             in input array.
   diff --> Value to be added to all nodes which have i in range */

//     bool prime[1000010];
// void SieveOfEratosthenes(int n)
// {
//     // Create a boolean array "prime[0..n]" and initialize
//     // all entries it as true. A value in prime[i] will
//     // finally be false if i is Not a prime, else true.

//     memset(prime, true, sizeof(prime));

//     for (int p=2; p*p<=n; p++)
//     {
//         // If prime[p] is not changed, then it is a prime
//         if (prime[p] == true)
//         {
//             // Update all multiples of p greater than or
//             // equal to the square of it
//             // numbers which are multiple of p and are
//             // less than p^2 are already been marked.
//             for (int i=p*p; i<=n; i += p)
//                 prime[i] = false;
//         }
//     }

//     // Print all prime numbers
//     // for (int p=2; p<=n; p++)
//        // if (prime[p])
//        //    cout << p << " ";
// }

// The function to update a value in input array and segment tree.
// It uses updateValueUtil() to update the value in segment tree

const long long MAX_SIZE = 1000001;

// isPrime[] : isPrime[i] is true if number is prime
// prime[] : stores all prime number less than N
// SPF[] that store smallest prime factor of number
// [for Exp : smallest prime factor of '8' and '16'
// is '2' so we put SPF[8] = 2 , SPF[16] = 2 ]
vector<long long >isprime(MAX_SIZE , true);
vector<long long >prime;
vector<long long >SPF(MAX_SIZE);

// function generate all prime number less then N in O(n)
void manipulated_seive(int N)
{
    // 0 and 1 are not prime
    isprime[0] = isprime[1] = false ;

    // Fill rest of the entries
    for (long long int i=2; i<N ; i++)
    {
        // If isPrime[i] == True then i is
        // prime number
        if (isprime[i])
        {
            // put i into prime[] vector
            prime.push_back(i);

            // A prime number is its own smallest
            // prime factor
            SPF[i] = i;
        }

        // Remove all multiples of  i*prime[j] which are
        // not prime by making isPrime[i*prime[j]] = false
        // and put smallest prime factor of i*Prime[j] as prime[j]
        // [ for exp :let  i = 5 , j = 0 , prime[j] = 2 [ i*prime[j] = 10 ]
        // so smallest prime factor of '10' is '2' that is prime[j] ]
        // this loop run only one time for number which are not prime
        for (long long int j=0;
             j < (int)prime.size() &&
             i*prime[j] < N && prime[j] <= SPF[i];
             j++)
        {
            isprime[i*prime[j]]=false;

            // put smallest prime factor of i*prime[j]
            SPF[i*prime[j]] = prime[j] ;
        }
    }
}

ll power(ll x,ll y,ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res%p;
}

int main()
{
    ll i,j,n,m,a,b,t;

    cin>>t;

    while(t--)
    {
        cin>>n;
        ll ar[n],ans[n];

        for(i=0;i<n;i++)
        {
            cin>>ar[i];
        }

        unordered_map<ll,ll> mp;
        ans[0] = ar[0];
        mp[ar[0]] = 1;
        ll temp;

        if(ar[0] != 1)
        {
            temp = 1;
        }
        else
            temp = 2;

        ll flag = 1;
        for(i=1;i<n;i++)
        {
            if(ar[i] == ar[i-1] && temp < ar[i])
            {
                ans[i] = temp;
                temp++;
                while(mp[temp] == 1)
                {
                    temp++;
                }
            }
            else if(ar[i] == ar[i-1] && temp >= ar[i])
            {
                flag = 0;
                break;
            }
            else
            {
                ans[i] = ar[i];
            }
        }

        if(flag == 0)
            cout<<"-1\n";
        else
        {
            for(i=0;i<n;i++)
                cout<<ans[i]<<" ";
            cout<<"\n";
        }

    }
    return 0;
}


 // #include <iostream>
#include <bits/stdc++.h>
/*#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>*/
#define ll long long
#define dl double
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define unique(a)       sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Assert(x)       {if(!(x)){cerr<<"Assertion failed at line "<<__LINE__<<": "<<#x<<" = "<<(x)<<"\n";exit(1);}}
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define mod 1000000007

using namespace std;

typedef long long LL;
   bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}
// A utility function to get the middle index from corner indexes.

/*  A recursive function to get the xor of values in given range
    of the array. The following are parameters for this function.

    st    --> Pointer to segment tree
    si    --> Index of current node in the segment tree. Initially
              0 is passed as root is always at index 0
    ss & se  --> Starting and ending indexes of the segment
                 represented by current node, i.e., st[si]
    qs & qe  --> Starting and ending indexes of query range */

/* A recursive function to update the nodes which have the given
   index in their range. The following are parameters
    st, si, ss and se are same as getXorUtil()
    i    --> index of the element to be updated. This index is
             in input array.
   diff --> Value to be added to all nodes which have i in range */

//     bool prime[1000010];
// void SieveOfEratosthenes(int n)
// {
//     // Create a boolean array "prime[0..n]" and initialize
//     // all entries it as true. A value in prime[i] will
//     // finally be false if i is Not a prime, else true.

//     memset(prime, true, sizeof(prime));

//     for (int p=2; p*p<=n; p++)
//     {
//         // If prime[p] is not changed, then it is a prime
//         if (prime[p] == true)
//         {
//             // Update all multiples of p greater than or
//             // equal to the square of it
//             // numbers which are multiple of p and are
//             // less than p^2 are already been marked.
//             for (int i=p*p; i<=n; i += p)
//                 prime[i] = false;
//         }
//     }

//     // Print all prime numbers
//     // for (int p=2; p<=n; p++)
//        // if (prime[p])
//        //    cout << p << " ";
// }

// The function to update a value in input array and segment tree.
// It uses updateValueUtil() to update the value in segment tree

const long long MAX_SIZE = 1000001;

// isPrime[] : isPrime[i] is true if number is prime
// prime[] : stores all prime number less than N
// SPF[] that store smallest prime factor of number
// [for Exp : smallest prime factor of '8' and '16'
// is '2' so we put SPF[8] = 2 , SPF[16] = 2 ]
vector<long long >isprime(MAX_SIZE , true);
vector<long long >prime;
vector<long long >SPF(MAX_SIZE);

// function generate all prime number less then N in O(n)
void manipulated_seive(int N)
{
    // 0 and 1 are not prime
    isprime[0] = isprime[1] = false ;

    // Fill rest of the entries
    for (long long int i=2; i<N ; i++)
    {
        // If isPrime[i] == True then i is
        // prime number
        if (isprime[i])
        {
            // put i into prime[] vector
            prime.push_back(i);

            // A prime number is its own smallest
            // prime factor
            SPF[i] = i;
        }

        // Remove all multiples of  i*prime[j] which are
        // not prime by making isPrime[i*prime[j]] = false
        // and put smallest prime factor of i*Prime[j] as prime[j]
        // [ for exp :let  i = 5 , j = 0 , prime[j] = 2 [ i*prime[j] = 10 ]
        // so smallest prime factor of '10' is '2' that is prime[j] ]
        // this loop run only one time for number which are not prime
        for (long long int j=0;
             j < (int)prime.size() &&
             i*prime[j] < N && prime[j] <= SPF[i];
             j++)
        {
            isprime[i*prime[j]]=false;

            // put smallest prime factor of i*prime[j]
            SPF[i*prime[j]] = prime[j] ;
        }
    }
}

ll power(ll x,ll y,ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res%p;
}

int main()
{
    ll i,j,n,m,a,b,t;

    cin>>t;

    while(t--)
    {
        cin>>n;
        ll ar[n],ans[n];

        for(i=0;i<n;i++)
        {
            cin>>ar[i];
        }
        ans[0] = ar[0];
        ll temp;

        if(ar[0] != 1)
        {
            temp = 1;
        }
        else
            temp = 2;

        ll flag = 1;
        for(i=1;i<n;i++)
        {
            if(ar[i] == ar[i-1] && temp <= ar[i])
            {
                ans[i] = temp;
                temp++;
            }
            else if(ar[i] == ar[i-1] && temp > ar[i])
            {
                flag = 0;
                break;
            }
            else
            {
                ans[i] = ar[i];
            }
        }

        if(flag == 0)
            cout<<"-1\n";
        else
        {
            for(i=0;i<n;i++)
                cout<<ans[i]<<" ";
            cout<<"\n";
        }

    }
    return 0;
}


 // #include <iostream>
#include <bits/stdc++.h>
/*#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>*/
#define ll long long
#define dl double
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define unique(a)       sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define Assert(x)       {if(!(x)){cerr<<"Assertion failed at line "<<__LINE__<<": "<<#x<<" = "<<(x)<<"\n";exit(1);}}
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define mod 1000000007

using namespace std;

typedef long long LL;
   bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}
// A utility function to get the middle index from corner indexes.

/*  A recursive function to get the xor of values in given range
    of the array. The following are parameters for this function.

    st    --> Pointer to segment tree
    si    --> Index of current node in the segment tree. Initially
              0 is passed as root is always at index 0
    ss & se  --> Starting and ending indexes of the segment
                 represented by current node, i.e., st[si]
    qs & qe  --> Starting and ending indexes of query range */

/* A recursive function to update the nodes which have the given
   index in their range. The following are parameters
    st, si, ss and se are same as getXorUtil()
    i    --> index of the element to be updated. This index is
             in input array.
   diff --> Value to be added to all nodes which have i in range */

//     bool prime[1000010];
// void SieveOfEratosthenes(int n)
// {
//     // Create a boolean array "prime[0..n]" and initialize
//     // all entries it as true. A value in prime[i] will
//     // finally be false if i is Not a prime, else true.

//     memset(prime, true, sizeof(prime));

//     for (int p=2; p*p<=n; p++)
//     {
//         // If prime[p] is not changed, then it is a prime
//         if (prime[p] == true)
//         {
//             // Update all multiples of p greater than or
//             // equal to the square of it
//             // numbers which are multiple of p and are
//             // less than p^2 are already been marked.
//             for (int i=p*p; i<=n; i += p)
//                 prime[i] = false;
//         }
//     }

//     // Print all prime numbers
//     // for (int p=2; p<=n; p++)
//        // if (prime[p])
//        //    cout << p << " ";
// }

// The function to update a value in input array and segment tree.
// It uses updateValueUtil() to update the value in segment tree

const long long MAX_SIZE = 1000001;

// isPrime[] : isPrime[i] is true if number is prime
// prime[] : stores all prime number less than N
// SPF[] that store smallest prime factor of number
// [for Exp : smallest prime factor of '8' and '16'
// is '2' so we put SPF[8] = 2 , SPF[16] = 2 ]
vector<long long >isprime(MAX_SIZE , true);
vector<long long >prime;
vector<long long >SPF(MAX_SIZE);

// function generate all prime number less then N in O(n)
void manipulated_seive(int N)
{
    // 0 and 1 are not prime
    isprime[0] = isprime[1] = false ;

    // Fill rest of the entries
    for (long long int i=2; i<N ; i++)
    {
        // If isPrime[i] == True then i is
        // prime number
        if (isprime[i])
        {
            // put i into prime[] vector
            prime.push_back(i);

            // A prime number is its own smallest
            // prime factor
            SPF[i] = i;
        }

        // Remove all multiples of  i*prime[j] which are
        // not prime by making isPrime[i*prime[j]] = false
        // and put smallest prime factor of i*Prime[j] as prime[j]
        // [ for exp :let  i = 5 , j = 0 , prime[j] = 2 [ i*prime[j] = 10 ]
        // so smallest prime factor of '10' is '2' that is prime[j] ]
        // this loop run only one time for number which are not prime
        for (long long int j=0;
             j < (int)prime.size() &&
             i*prime[j] < N && prime[j] <= SPF[i];
             j++)
        {
            isprime[i*prime[j]]=false;

            // put smallest prime factor of i*prime[j]
            SPF[i*prime[j]] = prime[j] ;
        }
    }
}

ll power(ll x,ll y,ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res%p;
}

int main()
{
    ll i,j,n,m,a,b,t;

    cin>>t;

    while(t--)
    {
        cin>>n;
        ll ar[n],ans[n];

        for(i=0;i<n;i++)
        {
            cin>>ar[i];
        }

        unordered_map<ll,ll> mp;
        ans[0] = ar[0];
        mp[ar[0]] = 1;
        ll temp;

        if(ar[0] != 1)
        {
            temp = 1;
        }
        else
            temp = 2;

        ll flag = 1;
        for(i=1;i<n;i++)
        {
            if(ar[i] == ar[i-1] && temp < ar[i])
            {
                ans[i] = temp;
                mp[temp] = 1;
                temp++;
                while(mp[temp] == 1)
                {
                    temp++;
                }
            }
            else if(ar[i] == ar[i-1] && temp >= ar[i])
            {
                flag = 0;
                break;
            }
            else
            {
                ans[i] = ar[i];
                mp[ar[i]] = 1;
            }
        }

        if(flag == 0)
            cout<<"-1\n";
        else
        {
            for(i=0;i<n;i++)
                cout<<ans[i]<<" ";
            cout<<"\n";
        }

    }
    return 0;
}


#include <bits/stdc++.h>
using  namespace std;

#define endl '\n'
#define ll long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
const db pi = acos(-1);
const long long infl = LLONG_MAX;

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase

int32_t main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll t,i,x,j,y,z,k,n;

tc(tt){
	cin>>n;	ll a[n],b[n],f[100009]={0};	bool br=true;
	j=1;
	rep(i,0,n,1){
		cin>>a[i];
	}

	b[0]=a[0];
	f[a[0]]++;

	rep(i,1,n,1){

		if(a[i]>b[i-1]&&f[a[i]]==0){
			f[a[i]]++;
			b[i]=a[i];
		} else{
			while(f[j]>0)	j++;
			if(j<a[i]){
				b[i]=j;
				f[j]++;
			}
			else{
				br=false;
				break;
			}
		}

	}
	rep(i,1,n+1,1)	br=br&&(f[i]>0);
	if(br){
		rep(i,0,n,1)	cout<<b[i]<<" ";	ce("")
	}
	else
		ce(-1)
}
}


#include <bits/stdc++.h>
using  namespace std;

#define endl '\n'
#define ll long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
const db pi = acos(-1);
const long long infl = LLONG_MAX;

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase

int32_t main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll t,i,x,j,y,z,k,n;

tc(tt){
	cin>>n;	ll a[n],b[n],f[100009]={0};	bool br=true;
	j=1;
	rep(i,0,n,1){
		cin>>a[i];
	}

	b[0]=a[0];
	f[a[0]]++;

	rep(i,1,n,1){

		if(a[i]>b[i-1]&&f[a[i]]==0){
			f[a[i]]++;
			b[i]=a[i];
		} else{
			while(f[j]>0)	j++;
			if(j<a[i])
				b[i]=j;
			else{
				br=false;
				break;
			}
		}

	}
	rep(i,1,n+1,1)	br=br&&(f[i]>0);
	if(br){
		rep(i,0,n,1)	cout<<b[i]<<" ";	ce("")
	}
	else
		ce(-1)
}
}


#include <bits/stdc++.h>
using  namespace std;

#define endl '\n'
#define ll long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
const db pi = acos(-1);
const long long infl = LLONG_MAX;

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase

int32_t main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll t,i,x,j,y,z,k,n;

tc(tt){
	cin>>n;	ll a[n],b[n],f[100009]={0};	bool br=true;
	j=1;
	rep(i,0,n,1){
		cin>>a[i];
	}

	b[0]=a[0];
	f[a[0]]++;

	rep(i,1,n,1){

		if(a[i]>b[i-1]&&f[a[i]]==0){
			f[a[i]]++;
			b[i]=a[i];
		} else if(a[i]<b[i-1]){
			br=false;
			break;
		}else{
			while(f[j]>0)	j++;
			if(j<a[i])
				b[i]=j;
			else{
				br=false;
				break;
			}
		}

	}
	rep(i,1,n+1,1)	br=br&&(f[i]>0);
	if(br){
		rep(i,0,n,1)	cout<<b[i]<<" ";	ce("")
	}
	else
		ce(-1)
}
}


#include <bits/stdc++.h>
using  namespace std;

#define endl '\n'
#define ll long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
const db pi = acos(-1);
const long long infl = LLONG_MAX;

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase

int32_t main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll t,i,x,j,y,z,k,n;

tc(tt){
	cin>>n;	ll a[n],b[n],f[100009]={0};	bool br=true;
	j=1;
	rep(i,0,n,1){
		cin>>a[i];
	}

	b[0]=a[0];
	f[a[0]]++;

	rep(i,1,n,1){

		if(a[i]>b[i-1]&&f[a[i]]==0){
			f[a[i]]++;
			b[i]=a[i];
		} else if(a[i]<b[i-1]){
			br=false;
			break;
		}else{
			while(f[j]>0)	j++;
			if(j<a[i]){
				b[i]=j;
				f[j]++;
			}
			else{
				br=false;
				break;
			}
		}

	}
	rep(i,1,n+1,1)	br=br&&(f[i]>0);
	if(br){
		rep(i,0,n,1)	cout<<b[i]<<" ";	ce("")
	}
	else
		ce(-1)
}
}


#include <bits/stdc++.h>
using  namespace std;

#define endl '\n'
#define ll long long
#define re register
#define pb(x) push_back(x)
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
const db pi = acos(-1);
const long long infl = LLONG_MAX;

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase

int32_t main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

ll t,i,x,j,y,z,k,n;

tc(tt){
	cin>>n;	ll a[n],b[n],f[100009]={0};
	j=1;
	rep(i,0,n,1){
		cin>>a[i];
	}

	b[0]=a[0];
	f[a[0]]++;

	rep(i,1,n,1){
		x=a[i];

		if(a[i]>b[i-1]&&f[a[i]]==0){
			f[a[i]]++;
			b[i]=a[i];
		} else{
			while(f[j])	j++;
			if(j<a[i])
			b[i]=j;
			else break;
		}

	}
	if(i==n){
		rep(i,0,n,1)	cout<<b[i]<<" ";	ce("")
	}
	else
		ce(-1)
}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	while(t!=0)
	{
		int n;
		cin>>n;
		int a[n];
		set<int> s;
		for(int i=0; i<n; i++)
		{
			s.insert(i+1);
			cin>>a[i];
		}
		int flag=0;
		s.erase(a[0]);
		for(int i=1; i<n; i++)
		{
			if (a[i]==a[i-1])
			{
				auto it=s.begin();
				if(*it>a[i])
					flag=1;
				a[i]=*it;
			}
			if (s.find(a[i])==s.end())
				flag=1;
			s.erase(a[i]);
			if (i>0 && a[i]==a[i-1])
			{
				flag=1;
			}
		}
		if (flag)
		{
			cout<<-1<<endl;
		}
		else
		{
			for(int i=0; i<n; i++)
				cout<<a[i]<<" ";
			cout<<endl;
		}
		t--;
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		int a[n];
		set<int> s;
		for(int i=0; i<n; i++)
		{
			s.insert(i+1);
			cin>>a[i];
		}
		int f[n+1]={0};
		for(int i=0; i<n; i++)
		{
			s.erase(a[i]);
			f[a[i]]=1;
		}
		int flag=0;
		for(int i=0; i<n-1; i++)
		{
			for(int j=i+1; j<n; j++)
			{
				if(a[i]==a[j])
				{
					auto it=s.begin();
					if(*it>a[i])
					{
						flag=1;
						break;
					}
					else
					{
						a[j]=*it;
						s.erase(a[j]);
						f[a[j]]=1;
					}
				}
				else
				{
					i=j-1;
					break;
				}
			}
			if (flag) break;
		}
		if (flag)
			cout<<-1<<endl;
		else
		{
			for(int i=0; i<n; i++)
				cout<<a[i]<<" ";
			cout<<endl;
		}
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		int a[n];
		set<int> s;
		for(int i=0; i<n; i++)
		{
			s.insert(i+1);
			cin>>a[i];
		}
		int f[n+1]={0};
		for(int i=0; i<n; i++)
		{
			s.erase(a[i]);
			f[a[i]]=1;
		}
		int flag=0;
		for(int i=0; i<n-1; i++)
		{
			for(int j=i+1; j<n; j++)
			{
				if(a[i]==a[j])
				{
					auto it=s.begin();
					if(*it>a[i])
						flag=1;
					else
					{
						a[j]=*it;
						s.erase(a[j]);
						f[a[j]]=1;
					}
				}
				else
				{
					i=j-1;
					break;
				}
			}
		}
		if (flag)
			cout<<-1<<endl;
		else
		{
			for(int i=0; i<n; i++)
				cout<<a[i]<<" ";
			cout<<endl;
		}
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	while(t!=0)
	{
		int n;
		cin>>n;
		int a[n];
		set<int> s;
		for(int i=0; i<n; i++)
		{
			s.insert(i+1);
			cin>>a[i];
		}
		int flag=0;
		for(int i=0; i<n-1; i++)
		{
			if (a[i]==a[i+1])
			{
				auto it=s.begin();
				a[i]=*it;
			}
			s.erase(a[i]);
			if (i>0 && a[i]==a[i-1])
			{
				flag=1;
			}
		}
		if (flag)
		{
			cout<<-1<<endl;
		}
		else
		{
			for(int i=0; i<n; i++)
				cout<<a[i]<<" ";
			cout<<endl;
		}
		t--;
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	while(t!=0)
	{
		int n;
		cin>>n;
		int a[n];
		set<int> s;
		for(int i=0; i<n; i++)
		{
			s.insert(i+1);
			cin>>a[i];
		}
		for(int i=0; i<n; i++)
		{
			s.erase(a[i]);
		}
		int f[n+1]={0};
		f[a[0]]=1;
		int flag=0;
		for(int i=1; i<n; i++)
		{
			if (a[i]==a[i-1]|| f[a[i]]==1)
			{
				auto it=s.begin();
				if (*it>a[i])
					flag=1;
				else
				{
					a[i]=*it;
					s.erase(*it);
					f[*it]=1;
				}
			}
			f[a[i]]=1;
		}
		if (flag)
			cout<<-1<<endl;
		else
		{
			for(int i=0; i<n; i++)
				cout<<a[i]<<" ";
			cout<<endl;
		}
		t--;
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int n;
	cin>>n;
	int a[n];
	for(int i=0; i<n; i++)
	{
		cin>>a[i];
	}
	int dp[n+1][n+1];
	for(int i=0; i<=n; i++)
	{
		dp[0][i]=0;
		dp[i][0]=0;
	}
	vector<int> v[n+1][n+1];
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<i; j++)
		{
			dp[i][j]=0;
			cout<<dp[i][j]<<" ";
		}
		vector<int> tmp;
		tmp=v[i-1];
		for(int j=i; j<=n; j++)
		{
			dp[i][j]=max(dp[i-1][j-1]+a[j-1],dp[i][j-1]);
			cout<<dp[i][j]<<" ";
		}
		v[i]=tmp;
		cout<<endl;
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	while(t!=0)
	{
		int n;
		cin>>n;
		int a[n];
		set<int> s;
		for(int i=0; i<n; i++)
		{
			s.insert(i+1);
			cin>>a[i];
		}
		for(int i=0; i<n; i++)
		{
			s.erase(a[i]);
		}
		int f[n+1]={0};
		f[a[0]]=1;
		int flag=0;
		for(int i=1; i<n; i++)
		{
			if (a[i]==a[i-1]|| f[a[i]]==1)
			{
				auto it=s.begin();
				if (*it>a[i])
					flag=1;
				else
				{
					a[i]=*it;
					s.erase(*it);
					f[*it]=1;
				}
			}
		}
		if (flag)
			cout<<-1<<endl;
		else
		{
			for(int i=0; i<n; i++)
				cout<<a[i]<<" ";
			cout<<endl;
		}
		t--;
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int t;
	cin>>t;
	while(t!=0)
	{
		int n;
		cin>>n;
		int a[n];
		set<int> s;
		for(int i=0; i<n; i++)
		{
			s.insert(i+1);
			cin>>a[i];
		}
		int flag=0;
		s.erase(a[0]);
		for(int i=1; i<n; i++)
		{
			if (a[i]==a[i-1])
			{
				auto it=s.begin();
				if(*it>a[i])
					flag=1;
				a[i]=*it;
			}
			s.erase(a[i]);
			if (i>0 && a[i]==a[i-1])
			{
				flag=1;
			}
		}
		if (flag)
		{
			cout<<-1<<endl;
		}
		else
		{
			for(int i=0; i<n; i++)
				cout<<a[i]<<" ";
			cout<<endl;
		}
		t--;
	}
}


#include <bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define ll long long
#define fo(i,n) for(ll i=0;i<n;++i)
#define Fo(i,k,n) for(ll i=k;i<n;++i)
#define vll vector<ll>
#define vvll vector<vector<ll> >
#define vpll vector<pair<ll,ll> >
#define all(v) v.begin(),v.end()
#define mll map<ll,ll>
#define mc map<char,ll>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define endl "\n"
#define inf 1e18
void get_it_done(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

bool cmp(pll a,pll b){
	return a.first<b.first;
}

int main(){
	get_it_done();
    int t=1;
    cin >> t;
    while (t--){
    	ll n;
    	cin>>n;
    	vll a(n);
        map<ll,ll> m;
        fo(i,n) cin>>a[i];
        vll p(n);
        if(a[0]>n){
            cout<<-1<<endl;
            continue;
        }
        p[0] = a[0];
        m[a[0]]++;
        bool flag = true;
        Fo(i,1,n){
            if(m[a[i]]>0){
                p[i] = -1;
                if(a[i]-(i+1)<0){
                    flag = false;
                    break;
                }
            }else{
                p[i] = a[i];
                m[a[i]]++;
            }
        }
        if(!flag){
            cout<<-1<<endl;
            continue;
        }
        ll cnt = 1;
        if(m[cnt]>0){
            cnt += 1;
        }
        Fo(i,1,n){
            if(p[i]==-1){
                p[i] = cnt;
                cnt += 1;
            }
            if(m[cnt]>0){
                cnt += 1;
            }
        }
        fo(i,n){
            cout<<p[i]<<" ";
        }
        cout<<endl;
    }
}


#include <bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define ll long long
#define fo(i,n) for(ll i=0;i<n;++i)
#define Fo(i,k,n) for(ll i=k;i<n;++i)
#define vll vector<ll>
#define vvll vector<vector<ll> >
#define vpll vector<pair<ll,ll> >
#define all(v) v.begin(),v.end()
#define mll map<ll,ll>
#define mc map<char,ll>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define endl "\n"
#define inf 1e18
void get_it_done(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int main(){
	get_it_done();
    int t=1;
    cin >> t;
    while (t--){
    	ll n;
    	cin>>n;
    	vll a(n);
    	map<ll,ll> m1;
    	map<ll,ll> m2;
    	fo(i,n) cin>>a[i],m1[a[i]]++;
    	vll p(n);
    	p[0] = a[0];
    	bool flag = true;
    	Fo(i,1,n){
    		if(a[i]==a[i-1]){
    			p[i] = -1;
    			if(a[i]-(i+1)<0){
    				flag = false;
    				break;
    			}
    		}
    		else{
    			p[i] = a[i];
    			m2[p[i]]++;
    		}
    	}
    	if(!flag){
    		cout<<-1<<endl;
    		continue;
    	}
    	ll cnt = 1;
    	if(a[0]==cnt){
    		cnt += 1;
    	}
    	Fo(i,1,n){
    		if(p[i]==-1){
    			p[i] = cnt;
    			cnt += 1;
    		}
    		if(m1[cnt]>0){
    			cnt += 1;
    		}
    	}

    	fo(i,n){
    		cout<<p[i]<<" ";
    	}
    	cout<<endl;

    }
}


#include <bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define ll long long
#define fo(i,n) for(ll i=0;i<n;++i)
#define Fo(i,k,n) for(ll i=k;i<n;++i)
#define vll vector<ll>
#define vvll vector<vector<ll> >
#define vpll vector<pair<ll,ll> >
#define all(v) v.begin(),v.end()
#define mll map<ll,ll>
#define mc map<char,ll>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define endl "\n"
#define inf 1e18
void get_it_done(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int main(){
	get_it_done();
    int t=1;
    cin >> t;
    while (t--){
    	ll n;
    	cin>>n;
    	vll a(n);
    	map<ll,ll> m1;
    	map<ll,ll> m2;
    	fo(i,n) cin>>a[i],m1[a[i]]++;
    	vll p(n);
    	p[0] = a[0];
    	bool flag = true;
    	Fo(i,1,n){
    		if(a[i]>n){
    			flag = false;
    			break;
    		}
    		if(a[i]==a[i-1]){
    			p[i] = -1;
    			if(a[i]-(i+1)<0){
    				flag = false;
    				break;
    			}
    		}
    		else{
    			p[i] = a[i];
    			m2[p[i]]++;
    		}
    	}
    	if(!flag){
    		cout<<-1<<endl;
    		continue;
    	}
    	ll cnt = 1;
    	if(a[0]==cnt){
    		cnt += 1;
    	}
    	Fo(i,1,n){
    		if(p[i]==-1){
    			p[i] = cnt;
    			cnt += 1;
    		}
    		if(m1[cnt]>0){
    			cnt += 1;
    		}
    	}

    	fo(i,n){
    		cout<<p[i]<<" ";
    	}
    	cout<<endl;

    }
}


#include <bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define ll long long
#define fo(i,n) for(ll i=0;i<n;++i)
#define Fo(i,k,n) for(ll i=k;i<n;++i)
#define vll vector<ll>
#define vvll vector<vector<ll> >
#define vpll vector<pair<ll,ll> >
#define all(v) v.begin(),v.end()
#define mll map<ll,ll>
#define mc map<char,ll>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define endl "\n"
#define inf 1e18
void get_it_done(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int main(){
	get_it_done();
    int t=1;
    cin >> t;
    while (t--){
    	ll n;
    	cin>>n;
    	vll a(n);
    	map<ll,ll> m1;
    	map<ll,ll> m2;
    	fo(i,n) cin>>a[i],m1[a[i]]++;
    	vll p(n);
    	p[0] = a[0];
    	bool flag = true;
    	if(a[0]>n){
    		flag = false;
    	}
    	Fo(i,1,n){
    		if(a[i]>n){
    			flag = false;
    			break;
    		}
    		if(a[i]==a[i-1]){
    			p[i] = -1;
    			if(a[i]-(i+1)<0){
    				flag = false;
    				break;
    			}
    		}
    		else{
    			p[i] = a[i];
    			m2[p[i]]++;
    		}
    	}
    	if(!flag){
    		cout<<-1<<endl;
    		continue;
    	}
    	ll cnt = 1;
    	if(a[0]==cnt){
    		cnt += 1;
    	}
    	Fo(i,1,n){
    		if(p[i]==-1){
    			p[i] = cnt;
    			cnt += 1;
    		}
    		if(m1[cnt]>0){
    			cnt += 1;
    		}
    	}

    	fo(i,n){
    		cout<<p[i]<<" ";
    	}
    	cout<<endl;

    }
}


#include <bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define ll long long
#define fo(i,n) for(ll i=0;i<n;++i)
#define Fo(i,k,n) for(ll i=k;i<n;++i)
#define vll vector<ll>
#define vvll vector<vector<ll> >
#define vpll vector<pair<ll,ll> >
#define all(v) v.begin(),v.end()
#define mll map<ll,ll>
#define mc map<char,ll>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define endl "\n"
#define inf 1e18
void get_it_done(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

bool cmp(pll a,pll b){
	return a.first<b.first;
}

int main(){
	get_it_done();
    int t=1;
    cin >> t;
    while (t--){
    	ll n;
    	cin>>n;
    	vll a(n);
        map<ll,ll> m;
        fo(i,n) cin>>a[i];
        vll p(n);
        if(a[0]>n){
            cout<<-1<<endl;
            continue;
        }
        p[0] = a[0];
        m[a[0]]++;
        bool flag = true;
        Fo(i,1,n){
            if(a[i]>n){
                flag = false;
                break;
            }
            if(m[a[i]]>0){
                p[i] = -1;
                if(a[i]-(i+1)<0){
                    flag = false;
                    break;
                }
            }else{
                p[i] = a[i];
                m[a[i]]++;
            }
        }
        if(!flag){
            cout<<-1<<endl;
            continue;
        }
        ll cnt = 1;
        if(m[cnt]>0){
            cnt += 1;
        }
        Fo(i,1,n){
            if(p[i]==-1){
                p[i] = cnt;
                m[cnt]++;
                cnt += 1;
            }
            while(m[cnt]>0){
                cnt += 1;
            }
        }
        fo(i,n){
            cout<<p[i]<<" ";
        }
        cout<<endl;
    }
}


#include <bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define ll long long
#define fo(i,n) for(ll i=0;i<n;++i)
#define Fo(i,k,n) for(ll i=k;i<n;++i)
#define vll vector<ll>
#define vvll vector<vector<ll> >
#define vpll vector<pair<ll,ll> >
#define all(v) v.begin(),v.end()
#define mll map<ll,ll>
#define mc map<char,ll>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define endl "\n"
#define inf 1e18
void get_it_done(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

bool cmp(pll a,pll b){
	return a.first<b.first;
}

int main(){
	get_it_done();
    int t=1;
    cin >> t;
    while (t--){
    	ll n;
    	cin>>n;
    	vll a(n);
        map<ll,ll> m;
        fo(i,n) cin>>a[i];
        vll p(n);
        if(a[0]>n){
            cout<<-1<<endl;
            continue;
        }
        p[0] = a[0];
        m[a[0]]++;
        bool flag = true;
        Fo(i,1,n){
            if(a[i]>n){
                flag = false;
                break;
            }
            if(m[a[i]]>0){
                p[i] = -1;
                if(a[i]-(i+1)<0){
                    flag = false;
                    break;
                }
            }else{
                p[i] = a[i];
                m[a[i]]++;
            }
        }
        if(!flag){
            cout<<-1<<endl;
            continue;
        }
        ll cnt = 1;
        if(m[cnt]>0){
            cnt += 1;
        }
        Fo(i,1,n){
            if(p[i]==-1){
                p[i] = cnt;
                cnt += 1;
            }
            if(m[cnt]>0){
                cnt += 1;
            }
        }
        fo(i,n){
            cout<<p[i]<<" ";
        }
        cout<<endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#define deb(x...) cout << #x << " = ["; _print(x)
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}
// =================
#define f(i, k, n) for (int i = k; i < n; i++)
#define r(i, k, n) for (int i = k; i >= n; i--)
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define len(s) s.size()
#define all(v) v.begin(), v.end()
#define tr(it, v) for (auto &it : v)
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<vi> vvi;
// =================

const int mod = 1e9;
const int N = 3e5 + 1;

void solve()
{
	int n;
	cin>>n;
	vi q(n),ans(n,-1);
	f(i,0,n) {
		cin>>q[i];
		if(!i) ans[i]=q[i];
		else if(q[i]>q[i-1]) ans[i]=q[i];
	}
	int curr=1,mx=0;
	// deb(ans);
	f(i,0,n) {
		amax(mx,ans[i]);
		// if(curr>mx) {
		// 	cout<<"-1\n";
		// 	return;
		// }
		if(curr==mx) curr++;
		if(ans[i]>0) continue;
		ans[i]=curr++;
	}
	mx=0;
	f(i,0,n) {
		amax(mx,ans[i]);
		if(mx==q[i]) continue;
		else {
			cout<<"-1\n";
			return;
		}
	}
	tr(it,ans) cout<<it<<" ";
	cout<<"\n";
}

signed main()
{
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int t = 1;
	cin>>t;
	while (t--)
		solve();
	return 0;
}


#include <cmath>
#include <cctype>
#include <cstdio>
#include <climits>
#include <cstring>

#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <bitset>
#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>

#define  D(x)             cout << #x " = " << (x) << endl;
#define  foreach(it, c)   for(decltype((c).begin()) it = (c).begin(); it!=(c).end(); ++it)
#define  foreachr(it, c)  for(decltype((c).rbegin()) it = (c).rbegin(); it!=(c).rend(); ++it)
#define  EPS              1e-9
#define  PI               acos(-1)

typedef unsigned long long int ull;
typedef long long int ll;
typedef unsigned uint;

inline int cmp(double x, double y=0, double tol=EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

typedef std::pair<float, float>  house;

int n, t;

int main() {
    //freopen("input.txt", "r", stdin);

    scanf("%d %d", &n, &t);
    std::vector<house> built(n);

    for(int i = 0; i < n; ++i) {
        scanf("%f %f", &built[i].first, &built[i].second);
        built[i].first -= built[i].second/2;
        built[i].second += built[i].first;
    }

    std::sort(built.begin(), built.end());

    int ans = 2;
    for(int i = 0; i < n; ++i) {
        if( i && built[i-1].second <= built[i].first - t )
            ++ans;
        if( i < n-1 && built[i].second + t < built[i+1].first )
            ++ans;
    }

    printf("%d\n", ans);

    //while(1);

    return 0;
}


//Hello. I'm Peter.
#include<cstdio>
#include<iostream>
#include<sstream>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<cctype>
#include<ctime>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<set>
#include<map>
#include<limits>
using namespace std;
#define iloveu cout<<"i love u"<<endl
#define input freopen("data.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
#define INT (0x3f3f3f3f)*2
#define LL (0x3f3f3f3f3f3f3f3f)*2
#define len(a) (int)strlen(a)
#define pb push_back
#define clr(a) memset(a,0,sizeof(a))
#define clr_minus1(a) memset(a,-1,sizeof(a))
#define clr_INT(a) memset(a,INT,sizeof(a))
#define clr_true(a) memset(a,true,sizeof(a))
#define clr_false(a) memset(a,false,sizeof(a))
#define clr_queue(q) while(!q.empty()) q.pop()
#define clr_stack(s) while(!s.empty()) s.pop()
#define rep(i, a, b) for (int i = a; i < b; i++)
#define dep(i, a, b) for (int i = a; i > b; i--)
#define repin(i, a, b) for (int i = a; i <= b; i++)
#define depin(i, a, b) for (int i = a; i >= b; i--)
#define pi 3.1415926535898
#define ll long long
#define eps 1e-6
#define MOD
#define MAXN 2100
#define N
#define M
int main()
{
    cout<<"看不懂这道题！"<<endl;
}


//Hello. I'm Peter.
#include<cstdio>
#include<iostream>
#include<sstream>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<cctype>
#include<ctime>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<set>
#include<map>
#include<limits>
using namespace std;
#define iloveu cout<<"i love u"<<endl
#define input freopen("data.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
#define INT (0x3f3f3f3f)*2
#define LL (0x3f3f3f3f3f3f3f3f)*2
#define len(a) (int)strlen(a)
#define pb push_back
#define clr(a) memset(a,0,sizeof(a))
#define clr_minus1(a) memset(a,-1,sizeof(a))
#define clr_INT(a) memset(a,INT,sizeof(a))
#define clr_true(a) memset(a,true,sizeof(a))
#define clr_false(a) memset(a,false,sizeof(a))
#define clr_queue(q) while(!q.empty()) q.pop()
#define clr_stack(s) while(!s.empty()) s.pop()
#define rep(i, a, b) for (int i = a; i < b; i++)
#define dep(i, a, b) for (int i = a; i > b; i--)
#define repin(i, a, b) for (int i = a; i <= b; i++)
#define depin(i, a, b) for (int i = a; i >= b; i--)
#define pi 3.1415926535898
#define ll long long
#define eps 1e-6
#define MOD
#define MAXN 2100
#define N
#define M
struct House
{
    double x;
    double a;
}h[MAXN];
bool comp(const House a,const House b)
{
    return a.x<b.x;
}
bool fequal(double x,double y)
{
    if(fabs(x-y)<eps) return true;
    else return false;
}
int main()
{
//    input;
    int n;
    double t,f1,f2;
    cin>>n>>t;
    repin(i,1,n)
    {
        scanf("%lf %lf",&f1,&f2);
        h[i].x=f1;
        h[i].a=f2;
    }
    if(n==1)
    {
        cout<<2<<endl;
        exit(0);
    }
    sort(h+1,h+1+n,comp);
    int ans=2;
    repin(i,1,n-1)
    {
        double tt=(double)1.0*((h[i+1].x-h[i].x)-(0.5*h[i].a+0.5*h[i+1].a));
        if(tt>t) ans+=2;
        else if(fequal(tt,t)) ans+=1;
    }
    cout<<ans<<endl;
}


//Hello. I'm Peter.
#include<cstdio>
#include<iostream>
#include<sstream>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<cctype>
#include<ctime>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<set>
#include<map>
#include<limits>
using namespace std;
#define iloveu cout<<"i love u"<<endl
#define input freopen("data.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
#define INT (0x3f3f3f3f)*2
#define LL (0x3f3f3f3f3f3f3f3f)*2
#define len(a) (int)strlen(a)
#define pb push_back
#define clr(a) memset(a,0,sizeof(a))
#define clr_minus1(a) memset(a,-1,sizeof(a))
#define clr_INT(a) memset(a,INT,sizeof(a))
#define clr_true(a) memset(a,true,sizeof(a))
#define clr_false(a) memset(a,false,sizeof(a))
#define clr_queue(q) while(!q.empty()) q.pop()
#define clr_stack(s) while(!s.empty()) s.pop()
#define rep(i, a, b) for (int i = a; i < b; i++)
#define dep(i, a, b) for (int i = a; i > b; i--)
#define repin(i, a, b) for (int i = a; i <= b; i++)
#define depin(i, a, b) for (int i = a; i >= b; i--)
#define pi 3.1415926535898
#define ll long long
#define eps 1e-6
#define MOD
#define MAXN 2100
#define N
#define M
struct House
{
    int x,a;
}h[MAXN];
bool comp(const House a,const House b)
{
    return a.x<b.x;
}
int main()
{
//    input;
    int n,t;
    cin>>n>>t;
    repin(i,1,n)
    {
        scanf("%d %d",&h[i].x,&h[i].a);
    }
    sort(h+1,h+1+n,comp);
    int ans=2;
    repin(i,1,n-1)
    {
        double tt=(double)1.0*(h[i+1].x-h[i].x)-(0.5*h[i].a-0.5*h[i+1].a);
        if(tt>2*t) ans+=2;
        else if(tt==2*t) ans+=1;
    }
    cout<<ans<<endl;
}


#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int main() {
	int n,t,x,a, ans=2;
	cin>>n>>t;
	vector <vector <int> > v;
	for (int i=0; i<n; i++) {
		cin>>x>>a;
		v.push_back(vector <int> {x,a});
	}
	for (int i=1; i<n; i++) {
		int d=(v[i][0]-v[i][1]/2.0)-(v[i-1][0]+v[i-1][1]/2.0);
		if (d > t)
			ans+=2;
		if (d==t)
			ans+=1;
	}
	cout << ans << endl;
}


#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int main() {
	int n,t,x,a, ans=2;
	cin>>n>>t;
	vector <double> vv;
	for (int i=0; i<n; i++) {
		cin>>x>>a;
		vv.push_back(x-a/2.0);
		vv.push_back(x+a/2.0);
	}
	sort(vv.begin(),vv.end());
	for (int i=2; i<vv.size(); i+=2) {
		int d=vv[i]-vv[i-1];
		if (d-t > 0.00001)
			ans+=2;
		if (abs(d-t)<0.00001)
			ans+=1;
	}
	cout << ans << endl;
}


#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int main() {
	int n,t,x,a, ans=2;
	cin>>n>>t;
	vector <double> vv;
	for (int i=0; i<n; i++) {
		cin>>x>>a;
		vv.push_back(x-a/2.0);
		vv.push_back(x+a/2.0);
	}
	sort(vv.begin(),vv.end());
	for (int i=2; i<vv.size(); i+=2) {
		int d=vv[i]-vv[i-1];
		if (d > t)
			ans+=2;
		if (d==t)
			ans+=1;
	}
	cout << ans << endl;
}


#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int main() {
	double n,t,x,a, ans=2;
	cin>>n>>t;
	vector <double> vv;
	for (int i=0; i<n; i++) {
		cin>>x>>a;
		vv.push_back(x-a/2.0);
		vv.push_back(x+a/2.0);
	}
	sort(vv.begin(),vv.end());
	for (int i=2; i<vv.size(); i+=2) {
		double d=vv[i]-vv[i-1];
		if (d > t)
			ans+=2;
		if (d==t)
			ans+=1;
	}
	cout << ans << endl;
}


#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int main() {
	double n,t,x,a, ans=2;
	cin>>n>>t;
	vector <double> vv;
	for (int i=0; i<n; i++) {
		cin>>x>>a;
		vv.push_back(x-a/2.0);
		vv.push_back(x+a/2.0);
	}
	sort(vv.begin(),vv.end());
	for (int i=2; i<vv.size(); i+=2) {
		int d=vv[i]-vv[i-1];
		if (d-t > 0.00001)
			ans+=2;
		if (abs(d-t)<0.00001)
			ans+=1;
	}
	cout << ans << endl;
}


#include<algorithm>
#include<bitset>
#include<cassert>
#include<complex>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define debug(x) {cerr <<#x <<" = " <<x <<endl; }
#define debugv(x) {{cerr <<#x <<" = "; FORE(it, (x)) cerr <<*it <<", "; cerr <<endl; }}
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef vector<int> VI;
template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
template<typename T1, typename T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { out << "(" << pair.X << ", " << pair.Y << ")"; return out; }

const int N = 1e3;
int n, t;
PII a[N];

int main(){
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    scanf("%d %d", &n, &t);
    REP(i, n) scanf("%d %d", &a[i].X, &a[i].Y);
    sort(a, a+n);
    int res = 2;
    REP(i, n-1) {
        int d = 2*a[i+1].X - 2*a[i].X - a[i].Y - a[i+1].Y;
        if (d >= t*2) ++res;
        if (d > t*2) ++res;
    }

    printf("%d\n", res);

    return 0;
}


//
// 15A.cpp
//
// Siwakorn Srisakaokul - ping128
// Written on Wednesday, 15 January 2014.
//

#include <cstdio>
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <algorithm>
#include <map>
#include <ctype.h>
#include <string.h>

#include <assert.h>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<PII, int> PII2;

#define MAXV 12000
#define OFFSET 6000

int in[MAXV];
int N, T;

int main() {
    scanf("%d %d", &N, &T);
    int cen, side;
    for (int i = 0; i < N; i++) {
        scanf("%d %d", &cen, &side);
        cen *= 2;
        side *= 2;
        in[cen - side / 2 + OFFSET]++;
        in[cen + side / 2 + OFFSET]--;
    }
    T *= 2;
    int sum = 0;
    for (int i = 0; i < MAXV; i++) {
        sum += in[i];
        if (sum) {
            in[i] = 1;
        } else {
            in[i] = 0;
        }
    }

    vector<int> a;
    for (int i = 0; i < MAXV; i++) {
        if (in[i] == 0 && in[i + 1] == 1) {
            a.push_back(i);
        } else if (in[i] == 1 && in[i + 1] == 0) {
            a.push_back(i);
        }
    }

    int ans = 2;
    for (int i = 1; i + 1 < a.size(); i += 2) {
        int ss = a[i + 1] - a[i];
        if (ss == T) {
            ans++;
        } else if (ss > T) {
            ans += 2;
        }
    }

    printf("%d\n", ans);
    return 0;
}


//
// 15A.cpp
//
// Siwakorn Srisakaokul - ping128
// Written on Wednesday, 15 January 2014.
//

#include <cstdio>
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <algorithm>
#include <map>
#include <ctype.h>
#include <string.h>

#include <assert.h>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<PII, int> PII2;

#define MAXV 12000
#define OFFSET 6000

int in[MAXV];
int N, T;

int main() {
    scanf("%d %d", &N, &T);
    int cen, side;
    for (int i = 0; i < N; i++) {
        scanf("%d %d", &cen, &side);
        cen *= 2;
        side *= 2;
        in[cen - side / 2 + OFFSET]++;
        in[cen + side / 2 + OFFSET]--;
    }

    int sum = 0;
    for (int i = 0; i < MAXV; i++) {
        sum += in[i];
        if (sum) {
            in[i] = 1;
        } else {
            in[i] = 0;
        }
    }

    vector<int> a;
    for (int i = 0; i < MAXV; i++) {
        if (in[i] == 0 && in[i + 1] == 1) {
            a.push_back(i);
        } else if (in[i] == 1 && in[i + 1] == 0) {
            a.push_back(i);
        }
    }

    int ans = 2;
    for (int i = 1; i + 1 < a.size(); i += 2) {
        int ss = a[i + 1] - a[i];
        ss /= 2;
        if (ss == T) {
            ans++;
        } else if (ss > T) {
            ans += 2;
        }
    }

    printf("%d\n", ans);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn = 1000 + 12;
vector < pair <float, float> > a;

int main()
{
    int n, t;
    cin >> n >> t;
    for(int i = 0; i < n; i ++){
        int x, l;
        cin >> x >> l;
        a.push_back(make_pair(x - float((l / (float)2)), x + float(l / (float) 2)));
        //cerr << a[i].second << endl;
    }
    sort(a.begin(), a.end());
    int ans = 2;
    for(int i = 0; i < n - 1; i ++){
        if(a[i + 1].first - t == a[i].second)
            ans ++;
        else if(a[i + 1].first - t > a[i].second)
            ans += 2;
    }
    cout << ans;
    return 0;
}