#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 20, INF = 0x3f3f3f3f;
int n, a[MAXN], prv[MAXN], rev[MAXN], dist[MAXN], ans[MAXN];
void solve() {
  memset(rev, 0, sizeof rev);
  memset(dist, 0, sizeof dist);
  memset(prv, 0, sizeof prv);
  memset(ans, INF, sizeof ans);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    prv[i] = rev[a[i]];
    rev[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) dist[a[i]] = max(dist[a[i]], i - prv[i]);
  for (int i = 1; i <= n; i++) dist[a[i]] = max(dist[a[i]], n + 1 - rev[a[i]]);
  for (int i = 1; i <= n; i++) ans[dist[a[i]]] = min(ans[dist[a[i]]], a[i]);
  for (int i = 2; i <= n; i++) ans[i] = min(ans[i], ans[i - 1]);
  for (int i = 1; i <= n; i++) cout << (ans[i] < INF ? ans[i] : -1) << " ";
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) solve();
}
