#include <bits/stdc++.h>
using namespace std;
const long long inf = 1000000000000000000;
const long long KOK = 100000;
const long long LOG = 30;
const long long li = 500005;
const long long mod = 1000000007;
int n, m, b[li], a[li], k, flag, t, mn[li], mx[li];
int ans;
string s;
vector<pair<int, int>> v;
int main(void) {
  scanf("%d", &t);
  while (t--) {
    v.clear();
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) {
      mn[i] = i;
      mx[i] = i;
      b[i] = a[i];
    }
    for (int i = 1; i <= n; i++) {
      if (a[i] == -1) continue;
      v.push_back({a[i], -i});
      a[i] = -1;
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    int ind = n;
    for (int i = 0; i < (int)v.size(); i++) {
      if (a[v[i].first] == -1 && v[i].first <= n) a[v[i].first] = ind--;
      a[-v[i].second] = ind--;
    }
    flag = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] == -1) a[i] = ind--;
    }
    stack<pair<int, int>> st;
    for (int i = n; i >= 1; i--) {
      while (st.size() && st.top().first <= a[i]) st.pop();
      int cur = 0;
      if (st.size())
        cur = st.top().second;
      else
        cur = n + 1;
      st.push({a[i], i});
      if (cur != b[i] && b[i] != -1) {
        flag = 1;
        break;
      }
    }
    if (flag)
      printf("-1");
    else
      for (int i = 1; i <= n; i++) printf("%d ", a[i]);
    printf("\n");
  }
  return 0;
}
