#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
const long long INF = 1e18;
long long n, k, c, pre;
long long a[N];
long long pos[N], dis[N], f[N];
void upd(long long x) {
  if (pre == -1)
    pre = x;
  else
    pre = min(pre, x);
}
void solve() {
  cin >> n;
  for (int i = 0; i <= n; ++i) pos[i] = dis[i] = 0, f[i] = INF;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    dis[a[i]] = max(dis[a[i]], i - pos[a[i]]);
    pos[a[i]] = i;
  }
  for (int i = 1; i <= n; ++i) {
    dis[a[i]] = max(dis[a[i]], n + 1 - pos[a[i]]);
    f[dis[a[i]]] = min(f[dis[a[i]]], a[i]);
  }
  for (int i = 1; i <= n; ++i) {
    f[i] = min(f[i - 1], f[i]);
    if (f[i] == INF)
      printf("-1 ");
    else
      printf("%lld ", f[i]);
  }
  putchar('\n');
}
int main() {
  int _;
  cin >> _;
  while (_--) solve();
  return 0;
}
