#include <bits/stdc++.h>
using namespace std;
int t, n, ma, now, s[1000005], ans[1000005];
struct fing {
  int v, num;
} a[1000005];
bool cmp(fing a, fing b) {
  if (a.v != b.v) return a.v < b.v;
  return a.num < b.num;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i].v), a[i].num = i;
    sort(a + 1, a + 1 + n, cmp);
    for (int i = 1; i <= n; i++) ans[i] = s[i] = 0;
    for (int i = 1; i <= n + 1; i++) {
      if (a[i].v != a[i - 1].v) {
        ma = max(ma, n - a[i - 1].num);
        s[a[i - 1].v] = ma + 1;
        ma = a[i].num - 1;
      } else
        ma = max(ma, a[i].num - a[i - 1].num - 1);
    }
    for (int i = n; i > 0; i--) ans[s[i]] = i;
    now = 1e9;
    for (int i = 1; i <= n; i++) {
      if (ans[i]) now = min(now, ans[i]);
      if (now == 1e9)
        printf("-1 ");
      else
        printf("%d ", now);
    }
    printf("\n");
  }
  return 0;
}
