#include <bits/stdc++.h>
using namespace std;
namespace my_template {
const long double PI =
    3.14159265358979323846264338327950288419716939937510582097494L;
template <typename T>
pair<T, T> operator+(const pair<T, T> &a, const pair<T, T> &b) {
  return pair<T, T>(a.first + b.first, a.second + b.second);
}
template <typename T>
pair<T, T> operator-(const pair<T, T> &a, const pair<T, T> &b) {
  return pair<T, T>(a.first - b.first, a.second - b.second);
}
template <typename T>
T operator*(const pair<T, T> &a, const pair<T, T> &b) {
  return (a.first * b.first + a.second * b.second);
}
template <typename T>
T operator^(const pair<T, T> &a, const pair<T, T> &b) {
  return (a.first * b.second - a.second * b.first);
}
template <typename T>
void print(vector<T> vec, string name = "") {
  cout << name;
  for (auto u : vec) cout << u << ' ';
  cout << '\n';
}
}  // namespace my_template
using namespace my_template;
const int MOD = 1000000007;
const long long INF = std::numeric_limits<long long>::max();
const int MX = 100101;
void solve() {
  int N;
  cin >> N;
  vector<vector<int> > kur(N + 1);
  vector<int> sk(N);
  for (int i = 0; i < N; ++i) {
    cin >> sk[i];
    kur[sk[i]].emplace_back(i);
  }
  vector<int> ats(N + 1, -1);
  for (int s = N; s >= 1; --s) {
    if (kur[s].empty()) continue;
    int last = -1;
    int dif = 0;
    for (auto u : kur[s]) {
      dif = max(dif, u - last);
      last = u;
    }
    dif = max(dif, N - last);
    if (dif <= N) ats[dif] = s;
  }
  for (int i = 1; i <= N; ++i) {
    if (ats[i - 1] != -1 and (ats[i] == -1 or ats[i] > ats[i - 1]))
      ats[i] = ats[i - 1];
  }
  for (int i = 1; i <= N; ++i) {
    printf("%d ", ats[i]);
  }
  printf("\n");
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) solve();
}
