#include <bits/stdc++.h>
const int N = 3e5 + 10;
int n, a[N], b[N], pre[N], las[N];
std::pair<int, int> c[N];
inline void fmax(int &a, int b) {
  if (a < b) a = b;
}
inline void fmin(int &a, int b) {
  if (a == -1 || a > b) a = b;
}
int main() {
  int i, j, t, m, mn;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (i = 1; i <= n; i++) scanf("%d", &a[i]), las[a[i]] = 0, b[i] = a[i];
    for (i = 1; i <= n; i++) pre[i] = las[a[i]], las[a[i]] = i;
    std::sort(b + 1, b + 1 + n);
    m = std::unique(b + 1, b + 1 + n) - b - 1;
    for (i = 1; i <= m; i++) c[i] = std::make_pair(n - las[b[i]] + 1, b[i]);
    for (i = 1; i <= n; i++)
      fmax(c[std::lower_bound(b + 1, b + 1 + m, a[i]) - b].first, i - pre[i]);
    std::sort(c + 1, c + 1 + m);
    mn = -1;
    for (i = j = 1; i <= n; i++) {
      while (j <= m && c[j].first <= i) fmin(mn, c[j++].second);
      printf("%d ", mn);
    }
    putchar('\n');
  }
  return 0;
}
