#include <bits/stdc++.h>
using namespace std;
priority_queue<long long> pq;
using vec = vector<long long>;
using mapa = map<long long, long long>;
long long fact(long long n) {
  long long ans = 1;
  for (long long i = 1; i <= n; i++) ans *= i;
  return ans;
}
long long glcm(vector<long long> &T) {
  long long size = T.size();
  map<long long, long long> mpi, mpf;
  for (long long i = 0; i < size; i++) {
    long long n = T[i];
    mpi.clear();
    for (long long j = 2; j * j <= n; j++) {
      while (n % j == 0) {
        mpi[j]++;
        mpf[j] = max(mpf[j], mpi[j]);
        n /= j;
      }
    }
    if (n > 1) mpi[n]++;
    mpf[n] = max(mpf[n], mpi[n]);
  }
  auto it = mpf.begin();
  long long ans = 1;
  while (it != mpf.end()) {
    long long u = (it->first), v = (it->second);
    long long p = pow(u, v);
    ans *= p;
    it++;
  }
  return ans;
}
bool cbit(long long n, long long pos) { return (n & (1 << pos)); }
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, j, k, l, m, n, t, p, x, r, y;
  cin >> t;
  while (t--) {
    cin >> n;
    long long a[n + 1];
    map<long long, vec> mp;
    vec vi(n + 1, 1000000007);
    for (i = 1; i <= n; i++) cin >> a[i], mp[a[i]].push_back(i);
    auto it = mp.begin();
    if (mp.size() == 1) {
      for (i = 0; i < n; i++) cout << a[n] << " ";
      cout << endl;
      continue;
    }
    while (it != mp.end()) {
      long long xi = (it->first);
      long long in = 1, dis = -1;
      for (i = 0; i < mp[xi].size(); i++) {
        if (i == 0)
          p = (mp[xi][i]);
        else
          p = (mp[xi][i] - in);
        dis = max(p, dis);
        in = mp[xi][i];
      }
      if (in < n) {
        p = (n - in) + 1;
        dis = max(p, dis);
      }
      vi[dis] = min(xi, vi[dis]);
      it++;
    }
    k = 1000000007 * 2;
    for (i = 1; i <= n; i++) {
      k = min(k, vi[i]);
      vi[i] = k;
    }
    for (i = 1; i <= n; i++) {
      if (vi[i] >= 1000000007)
        cout << "-1 ";
      else
        cout << vi[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
