#include <bits/stdc++.h>
struct value {
  int v, p;
  bool operator<(const value &other) const {
    if (v != other.v) {
      return v > other.v;
    }
    return p < other.p;
  }
};
value p[500005];
int ans[500005];
int used[500005];
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i].v);
    p[i].p = i;
    used[i] = 0;
  }
  std::stack<int> nextHigh;
  for (int i = 1; i <= n; i++) {
    int nextV = p[i - 1].v;
    while (!nextHigh.empty() && nextHigh.top() == i) {
      nextHigh.pop();
    }
    if (!nextHigh.empty()) {
      int h = nextHigh.top();
      if (nextV > h) {
        printf("-1\n");
        return;
      }
    }
    if (nextV != -1) {
      nextHigh.push(nextV);
    }
  }
  if (!nextHigh.empty()) {
    if (nextHigh.top() == n + 1) {
      nextHigh.pop();
    } else {
      throw "";
    }
  }
  std::sort(p, p + n);
  used[n] = 1;
  int next = n;
  for (int i = 0; i < n; i++) {
    if (used[p[i].p]) continue;
    if (p[i].v != -1 && !used[p[i].v - 1]) {
      ans[p[i].v - 1] = next--;
      used[p[i].v - 1] = true;
    }
    ans[p[i].p] = next--;
    used[p[i].p] = true;
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", ans[i]);
  }
  printf("\n");
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
