#include <bits/stdc++.h>
int next[500100];
int used[500100];
int aus[500100];
int big[500100];
std::vector<int> erg;
int n;
int aktP;
int dfs(int v) {
  used[v] = 1;
  if (big[v] < next[v]) return 0;
  aktP++;
  for (; aktP < next[v];) {
    if (used[aktP]) {
    } else {
      big[aktP] = next[v];
      if (!dfs(aktP)) return 0;
    };
  };
  erg.push_back(v);
  aus[v] = erg.size();
  return 1;
};
int main(void) {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
      scanf("%d", &next[i]);
      next[i]--;
      used[i] = 0;
      aus[i] = 0;
      big[i] = next[i];
    };
    erg.clear();
    int pos = 1;
    aktP = 0;
    for (int i = 0; i < n; i++) {
      if (!used[i]) {
        aktP = i;
        if (!dfs(i)) {
          pos = 0;
          break;
        };
      };
    };
    if (pos) {
      for (int i = 0; i < n; i++) {
        printf("%d ", aus[i]);
      };
      puts("");
    } else {
      printf("-1\n");
    };
  };
  return 0;
};
