#include <bits/stdc++.h>
using namespace std;
using pii = pair<long long, long long>;
using vi = vector<long long>;
const long long MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;
string S;
vi va, vb;
void solve() {
  long long T_;
  cin >> T_;
  for (long long _ = (long long)(1); _ <= (long long)(T_); ++_) {
    long long n;
    cin >> n;
    vi a(n);
    vector<vi> hist(n + 1);
    for (long long i = (long long)(0); i <= (long long)(n - 1); ++i) {
      cin >> a[i];
      hist[a[i]].push_back(i);
    }
    vi ans(n, INF);
    for (long long i = (long long)(1); i <= (long long)(n); ++i) {
      vi hi = hist[i];
      if (hi.size() == 0) {
        continue;
      }
      hi.push_back(-1);
      hi.push_back(n);
      sort(hi.begin(), hi.end());
      long long mx = 0;
      for (long long l = (long long)(1); l <= (long long)(hi.size() - 1); ++l) {
        mx = max(mx, hi[l] - hi[l - 1]);
      }
      ans[mx - 1] = min(ans[mx - 1], i);
    }
    long long mn = INF;
    long long flg = false;
    for (long long i = (long long)(0); i <= (long long)(n - 1); ++i) {
      if (!flg && (ans[i] == INF)) {
        ans[i] = -1;
      } else {
        flg = true;
        mn = min(mn, ans[i]);
        ans[i] = min(ans[i], mn);
      }
    }
    for (auto &x : (ans)) {
      cout << x << " ";
    }
    cout << endl;
  }
}
signed main() {
  cout << setprecision(12);
  solve();
  return 0;
}
