#include <bits/stdc++.h>
using namespace std;
const long long N = 5e5 + 10;
long long A[N];
long long ans[N];
long long rp[N];
void solve() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> A[i];
  }
  deque<long long> q;
  q.push_front(n + 1);
  for (long long i = 1; i <= n; i++) {
    if (q.front() == i) {
      q.pop_front();
    }
    if (A[i] != -1) {
      if (A[i] <= q.front()) {
        if (A[i] != q.front()) {
          q.push_front(A[i]);
        }
      } else {
        cout << -1 << endl;
        return;
      }
    }
    ans[i] = q.front();
  }
  vector<pair<long long, long long> > v;
  for (long long i = 1; i <= n; i++) {
    v.push_back({ans[i], -i});
  }
  sort(v.rbegin(), v.rend());
  for (long long i = 0; i < n; i++) {
    rp[-v[i].second] = n - i;
  }
  for (long long i = 1; i <= n; i++) {
    cout << rp[i] << " ";
  }
  cout << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  cout << fixed;
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
