#include <bits/stdc++.h>
using namespace std;
int T;
int n;
int a[1000005];
int c[1000005];
int ans[1000005];
struct aa {
  int d, i;
} d[1000005];
void read(int& x) {
  int f = 1;
  x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  x *= f;
}
void jia(int x, int y) {
  while (x <= n) {
    c[x] += y;
    x += (x & (-x));
  }
}
int he(int x) {
  int ans = 0;
  while (x > 0) {
    ans += c[x];
    x -= (x & (-x));
  }
  return ans;
}
void huanyuan() {
  for (int i = 1; i <= n + 2; i++) {
    c[i] = 0;
    a[i] = 0;
    d[i].d = 0;
    d[i].i = 0;
    ans[i] = 0;
  }
}
bool cmp(aa a, aa b) { return a.d > b.d || a.d == b.d && a.i < b.i; }
void Orz() {
  cin >> n;
  for (int i = 1; i <= n; i++) read(a[i]);
  for (int i = 1; i <= n; i++)
    if (a[i] != -1) {
      if (he(i) != he(a[i] - 1)) {
        cout << -1 << "\n";
        huanyuan();
        return;
      }
      jia(a[i], -1);
      jia(i + 1, 1);
    }
  for (int i = 1; i <= n; i++) {
    d[i].d = he(i);
    d[i].i = i;
  }
  sort(d + 1, d + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    ans[d[i].i] = i;
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  printf("\n");
  huanyuan();
}
signed main() {
  cin >> T;
  while (T--) {
    Orz();
  }
  return 0;
}
