#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
const long long inf = 0x7f7f7f7f7f;
const long long N = 600040;
long long a[N], b[N], c[N], d[N];
long long n, m;
long long _;
long long cmp(long long a, long long b) { return c[a] < c[b]; }
void solve() {
  sort(d + 1, d + n + 1, cmp);
  long long res = inf, lst = 1;
  for (long long i = 1; i <= n; i++) {
    if (d[i] < res) {
      for (long long j = lst; j < c[d[i]]; j++) {
        printf("%lld ", (res == inf) ? -1 : res);
      }
      res = d[i];
      lst = c[d[i]];
    }
  }
  for (long long i = lst; i <= n; i++) {
    printf("%lld ", (res == inf) ? -1 : res);
  }
  puts("");
}
signed main() {
  for (_ = read(); _; _--) {
    n = read();
    fill(b, b + n + 1, 0);
    fill(c, c + n + 1, 0);
    for (long long i = 1; i <= n; i++) {
      a[i] = read();
      d[i] = i;
      c[a[i]] = max(c[a[i]], i - b[a[i]]);
      b[a[i]] = i;
    }
    for (long long i = 1; i <= n; i++) {
      c[i] = max(c[i], n - b[i] + 1);
    }
    solve();
  }
}
