#include <bits/stdc++.h>
using namespace std;
class segtree {
 public:
  static const int N = 1 << 19;
  int dp[1 << 20];
  segtree() { memset(dp, -1, sizeof(dp)); }
  void update(int k, int v) {
    k += N - 1;
    dp[k] = v;
    while (k > 0) {
      k = (k - 1) / 2;
      dp[k] = max(dp[k * 2 + 1], dp[k * 2 + 2]);
    }
  }
  int query(int a, int b, int k = 0, int l = 0, int r = N) {
    if (b <= l || r <= a) return -1;
    if (a <= l && r <= b) return dp[k];
    int mid = (l + r) / 2;
    int vl = query(a, b, k * 2 + 1, l, mid);
    int vr = query(a, b, k * 2 + 2, mid, r);
    return max(vl, vr);
  }
};
segtree seg;
int n;
int a[500005];
bool flag[500005];
int ans[500005];
int anspos[500005];
bool solve() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    flag[i] = false;
  }
  vector<pair<int, int> > vec;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] == -1) {
      flag[i] = true;
    } else {
      a[i]--;
      vec.push_back(pair<int, int>(a[i], -i));
    }
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < n; i++) {
    seg.update(i, -1);
  }
  int pos = 0;
  int vpos = 0;
  for (int i = 0; i <= n; i++) {
    while (vpos < vec.size() && vec[vpos].first <= i) {
      int val = -vec[vpos].second;
      if (seg.query(0, val) > val) return false;
      ans[pos++] = val;
      seg.update(val, vec[vpos].first);
      vpos++;
    }
    if (flag[i]) {
      if (seg.query(0, i) > i) return false;
      ans[pos++] = i;
    }
  }
  for (int i = 0; i < n; i++) {
    anspos[ans[i]] = i;
  }
  return true;
}
int main(void) {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    if (solve()) {
      for (int i = 0; i < n; i++) {
        printf("%d%c", anspos[i] + 1, i + 1 == n ? '\n' : ' ');
      }
    } else {
      printf("-1\n");
    }
  }
  return 0;
}
