#include <bits/stdc++.h>
using namespace std;
int T;
long long N;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> T;
  while (T--) {
    cin >> N;
    vector<int> v(N);
    for (auto &x : v) cin >> x;
    vector<int> c[N + 1];
    for (int i = 0; i < N + 1; i++) c[i].push_back(0);
    for (int i = 0; i < N; i++) c[v[i]].push_back(i + 1);
    for (int i = 0; i < N + 1; i++) c[i].push_back(N + 1);
    vector<pair<int, int> > kek(N + 1);
    for (int i = 0; i <= N; i++) kek[i] = {0, i};
    for (int i = 0; i < N + 1; i++) {
      for (int j = 0; j < c[i].size() - 1; j++)
        kek[i].first = max(kek[i].first, c[i][j + 1] - c[i][j]);
    }
    sort(kek.begin(), kek.end());
    int ind = -1;
    priority_queue<int> pq;
    for (int i = 1; i <= N; i++) {
      while (ind < N && kek[ind + 1].first <= i) {
        ind++;
        pq.push(-kek[ind].second);
      }
      if (pq.empty())
        cout << "-1 ";
      else
        cout << -pq.top() << " ";
    }
    cout << "\n";
  }
  return 0;
}
