#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
void solve() {
  int n;
  cin >> n;
  vector<vector<int> > pos(n + 1);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    pos[x].push_back(i);
  }
  vector<int> upd(n + 1, inf);
  for (int i = 1; i <= n; ++i) {
    if (pos[i].empty()) continue;
    int now = 0;
    for (int j = 1; j < (int)(pos[i]).size(); ++j)
      now = max(now, pos[i][j] - pos[i][j - 1] - 1);
    now = max(pos[i][0], now);
    now = max(n - 1 - pos[i].back(), now);
    upd[now + 1] = min(upd[now + 1], i);
  }
  int ans = inf;
  for (int i = 1; i <= n; ++i) {
    ans = min(ans, upd[i]);
    if (ans == inf)
      cout << -1;
    else
      cout << ans;
    cout << ' ';
  }
  cout << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
