#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
  int n;
  cin >> n;
  vector<int> last_pos(n, -1);
  vector<int> max_dist(n);
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    --t;
    max_dist[t] = max(max_dist[t], i - last_pos[t]);
    last_pos[t] = i;
  }
  for (int i = 0; i < n; ++i) {
    max_dist[i] = max(max_dist[i], n - last_pos[i]);
  }
  vector<pair<int, int>> sorted;
  sorted.reserve(n);
  for (int i = 0; i < n; ++i) {
    sorted.emplace_back(i, max_dist[i]);
  }
  vector<int> ans(n, -1);
  for (int i = 0; i < n; ++i) {
    if (max_dist[i] > n) {
      continue;
    }
    int k = max_dist[i] - 1;
    for (int j = k; j < n && ans[j] == -1; ++j) {
      ans[j] = i + 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << ' ';
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
