#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 3;
long long prime[100002];
long long exp(long long a, long long b);
void sieve(long long n);
long long gcd(long long a, long long b);
long long countdigit(long long n);
long long check(string str);
vector<long long> ft;
long long sum_digit(long long n) {
  long long s = 0;
  while (n > 0) {
    s += (n % 10);
    n = n / 10;
  }
  return s;
}
void solve() {
  long long n, s;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    --a[i];
  }
  vector<long long> v[n];
  for (long long i = 0; i < n; i++) v[i].push_back(-1);
  for (long long i = 0; i < n; i++) v[a[i]].push_back(i);
  for (long long i = 0; i < n; i++) v[i].push_back(n);
  long long gap[n];
  for (long long i = 0; i < n; i++) {
    gap[i] = 0;
    for (long long j = 1; j < v[i].size(); j++) {
      gap[i] = max(gap[i], v[i][j] - v[i][j - 1] - 1);
    }
  }
  long long best[n + 1];
  const long long inf = 1e10;
  for (long long i = 0; i <= n; i++) best[i] = inf;
  for (long long i = 0; i < n; i++) best[gap[i]] = min(best[gap[i]], i + 1);
  long long r = n + 1;
  for (long long i = 0; i < n; i++) {
    r = min(r, best[i]);
    if (r == n + 1)
      cout << -1 << " ";
    else
      cout << r << " ";
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
long long exp(long long a, long long b) {
  int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res % mod;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
void sieve(long long n) {
  for (long long i = 0; i <= n; i++) {
    prime[i] = 1;
  }
  prime[0] = 0;
  prime[1] = 0;
  for (long long i = 2; i <= n; i++) {
    if (prime[i] == 1) {
      for (long long j = 2; i * j <= n; j++) {
        prime[i * j] = 0;
      }
    }
  }
}
long long countdigit(long long n) { return floor(log10(n) + 1); }
long long check(string str) {
  long long l = 0;
  long long h = str.size() - 1;
  while (h > l) {
    if (str[l++] != str[h--]) {
      return 0;
    }
  }
  return 1;
}
