#include <bits/stdc++.h>
using namespace std;
long long int INF = 1e18;
long long int MOD = 1e9 + 7;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> ind[n + 1];
  for (long long int i = 0; i < n; i++) {
    long long int temp;
    cin >> temp;
    ind[temp].push_back(i);
  }
  vector<long long int> k(n + 1, -1);
  for (long long int i = 1; i < n + 1; i++) {
    auto inds = ind[i];
    if (inds.size() == 0) continue;
    inds.push_back(n);
    long long int prev = -1, maxx = -1LL;
    for (long long int j = 0; j < inds.size(); j++) {
      maxx = max(inds[j] - prev, maxx);
      prev = inds[j];
    }
    if (k[maxx] == -1) k[maxx] = i;
  }
  long long int ans = INF;
  for (long long int i = 1; i < n + 1; i++) {
    if (k[i] != -1) ans = min(ans, k[i]);
    if (ans < INF)
      cout << ans << " ";
    else
      cout << k[i] << " ";
  }
  cout << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
