#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<vector<int>> idx(n + 10);
  vector<int> val(n + 10);
  vector<int> app(n + 10, 0x3f3f3f3f);
  for (int i = 1; i <= n; i++) {
    idx[i].push_back(-1);
    idx[i].push_back(n);
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    idx[x].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    sort(idx[i].begin(), idx[i].end());
    int sz = (int)(idx[i].size());
    int gap = 0;
    for (int j = 0; j < sz - 1; j++) {
      gap = max(gap, idx[i][j + 1] - idx[i][j]);
    }
    app[gap] = min(app[gap], i);
  }
  int ans = 0x3f3f3f3f;
  for (int i = 1; i <= n; i++) {
    ans = min(app[i], ans);
    if (ans == 0x3f3f3f3f) {
      cout << "-1 ";
    } else {
      cout << ans << ' ';
    }
  }
  cout << '\n';
}
int main() {
  cin.tie(0)->sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
