#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,fma")
using std::cin;
using std::cout;
using std::vector;
using ll = long long;
using uint = unsigned int;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vpii = vector<pii>;
using vb = vector<std::bitset<10>>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
const auto ready = []() {
  cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  return true;
}();
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vvi inds(n + 1);
    vi extra(n + 1, int(1e9));
    for (int i = 0; i < n; ++i) {
      int x;
      cin >> x;
      inds[x].push_back(i);
    }
    for (int i = 0; i < n + 1; ++i) {
      int mx = 0;
      for (int j = 1; j < inds[i].size(); ++j)
        mx = std::max(mx, inds[i][j] - inds[i][j - 1]);
      if (inds[i].size()) {
        mx = std::max(mx, inds[i][0] + 1);
        mx = std::max(mx, n - inds[i].back());
      }
      extra[mx] = std::min(extra[mx], i);
    }
    int cur = 1e9;
    for (int i = 1; i <= n; ++i) {
      cur = std::min(cur, extra[i]);
      cout << ((cur < 1e9) ? cur : -1) << " ";
    }
    cout << "\n";
  }
  return 0;
}
