#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  ;
  vector<long long> v(n);
  vector<vector<long long> > v1(n + 1);
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = 1; i < n + 1; i++) v1[i].push_back(0);
  for (long long i = 0; i < n; i++) {
    v1[v[i]].push_back(i + 1);
  }
  for (long long i = 1; i < n + 1; i++) v1[i].push_back(n + 1);
  vector<long long> ans(n + 1, 1e9);
  for (long long i = 1; i < n + 1; i++) {
    long long a = -1;
    for (long long j = 1; j < v1[i].size(); j++) {
      a = max(a, v1[i][j] - v1[i][j - 1]);
    }
    if (a <= n) ans[a] = min(ans[a], i);
  }
  for (long long i = 1; i < n + 1; i++) {
    ans[i] = min(ans[i - 1], ans[i]);
  }
  for (long long i = 1; i < n + 1; i++) {
    if (ans[i] == 1e9)
      cout << "-1 ";
    else
      cout << ans[i] << " ";
  }
  cout << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
