#include <bits/stdc++.h>
using namespace std;
const int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const long long int mod = 1e9 + 7;
const long double EPS = 1e-12;
const int N = 1e5 + 20;
void solve() {
  long long int n, temp;
  cin >> n;
  map<long long int, vector<long long int>> mp;
  mp.clear();
  for (int i = 0; i < n; i++) {
    cin >> temp;
    mp[temp].push_back(i);
  }
  long long int pr = n + 1;
  vector<long long int> ans;
  ans.assign(n + 1, -1);
  ans[n] = 7;
  for (auto [num, v] : mp) {
    v.push_back(-1);
    v.push_back(n);
    sort(v.begin(), v.end());
    int nn = v.size();
    long long int mx = 0;
    for (int i = 1; i < nn; i++) {
      mx = max(mx, v[i] - v[i - 1]);
    }
    if (mx < pr) {
      pr = mx;
      int j = mx - 1;
      while (ans[j] == -1) {
        ans[j] = num;
        j++;
      }
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
