#include <bits/stdc++.h>
using namespace std;
void error(const char *s) {
  cerr << s << endl;
  exit(10);
}
int runit() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  vector<pair<long long, long long>> stack;
  vector<long long> succ;
  int fail = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (v[i] < 0)
      v[i] = i + 1;
    else
      v[i] = v[i] - 1;
    stack.push_back({v[i], -i});
    while (succ.size() > 0 && succ[succ.size() - 1] == i) succ.pop_back();
    if (succ.size() > 0 && v[i] > succ[succ.size() - 1]) {
      fail++;
    }
    succ.push_back(v[i]);
  }
  if (fail) return 0;
  sort(stack.begin(), stack.end());
  vector<long long> res(n);
  for (int i = 0; i < n; i++) res[-stack[i].second] = i + 1;
  for (int i = 0; i < n; i++) cout << " " << res[i];
  cout << endl;
  return 1;
}
int main() {
  long long n;
  cin >> n;
  for (int t = 0; t < n; t++)
    if (runit() == 0) cout << -1 << endl;
}
