#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
const long long NINF = -INF;
const int mod = 1e9 + 7;
const int inf = 1e9;
const int ninf = -inf;
long long pow(long long a, long long b, long long mod) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long res = pow(a, b / 2, mod);
  if (b & 1) {
    return (res % mod * (res % mod * a % mod) % mod) % mod;
  } else {
    return (res % mod * res % mod) % mod;
  }
}
long long modInverse(long long n, long long mod) {
  return pow(n, mod - 2, mod) % mod;
}
long long nCr(long long n, long long r, long long mod) {
  long long fact[n + 1];
  fact[1] = 1;
  for (long long i = 2; i <= n; i++) {
    fact[i] = (fact[i - 1] % mod * i % mod) % mod;
  }
  return (fact[n] % mod *
          (modInverse(fact[r], mod) % mod * modInverse(fact[n - r], mod) %
           mod) %
          mod) %
         mod;
}
vector<int> sieve(int n) {
  vector<int> primes;
  bool visited[n + 1];
  memset(visited, 0, sizeof visited);
  int i, j;
  for (i = 2; i * i <= n; i++) {
    if (visited[i]) continue;
    for (j = 2 * i; j <= n; j += i) {
      visited[j] = true;
    }
  }
  for (i = 2; i <= n; i++) {
    if (!visited[i]) primes.push_back(i);
  }
  return primes;
}
void solve() {
  int n;
  cin >> n;
  int a[n + 1], i, j;
  int f[n + 1], last[n + 1], ans[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    ans[i] = -1, f[i] = 0, last[i] = 0;
  }
  for (i = 1; i <= n; i++) {
    int x = a[i];
    f[x] = max(f[x], i - last[x]);
    last[x] = i;
  }
  for (i = 1; i <= n; i++) {
    f[i] = max(f[i], n - last[i] + 1);
    for (j = f[i]; j <= n && ans[j] == -1; j++) {
      ans[j] = i;
    }
  }
  for (i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
