#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  map<int, vector<int>> mp;
  for (int i = 0; i < n; i++) mp[a[i]].push_back(i + 1);
  vector<int> z(n, -1);
  for (auto& [val, v] : mp) {
    int mx = max(v[0], n + 1 - v.back());
    for (int i = 1; i < v.size(); i++) mx = max(mx, v[i] - v[i - 1]);
    --mx;
    if (z[mx] == -1) z[mx] = val;
  }
  int last = -1;
  for (int i = 0; i < n; i++) {
    if (last == -1)
      last = z[i];
    else if (z[i] != -1)
      last = min(last, z[i]);
    z[i] = last;
  }
  for (auto val : z) cout << val << " ";
  cout << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
