#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1e18;
void solve() {
  long long N;
  cin >> N;
  vector<long long> a(N);
  map<long long, vector<long long>> mp;
  for (int i = 0; i < N; i++) cin >> a[i];
  vector<long long> ans(N + 1);
  for (int i = 0; i <= N; i++) ans[i] = INF;
  for (int i = 0; i < N; i++) {
    if (mp.count(a[i]) == 0) {
      mp[a[i]].push_back(-1);
    }
    mp[a[i]].push_back(i);
  }
  for (auto tmp : mp) {
    auto val = tmp.first;
    auto v = tmp.second;
    v.push_back(N);
    long long minimum = 1;
    for (int i = 1; i < v.size(); i++) {
      chmax(minimum, v[i] - v[i - 1]);
    }
    chmin(ans[minimum], val);
  }
  for (int i = 1; i <= N; i++) {
    chmin(ans[i], ans[i - 1]);
    if (ans[i] == INF)
      cout << -1 << " ";
    else
      cout << ans[i] << " ";
  }
  cout << "\n";
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long T;
  cin >> T;
  while (T--) solve();
  return 0;
}
