#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int t, n, x, a[N], b[N], c[N], d[N];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]), b[i] = c[i] = 0;
    for (int i = 1; i <= n; i++) {
      x = a[i];
      if (b[x])
        c[x] = max(c[x], i - b[x]);
      else
        c[x] = i;
      b[x] = i;
    }
    for (int i = 1; i <= n; i++) c[i] = max(c[i], n - b[i] + 1);
    d[1] = c[1];
    for (int i = 2; i <= n; i++) d[i] = min(d[i - 1], c[i]);
    x = n;
    for (int i = 1; i <= n; i++) {
      while (x && d[x] <= i) x--;
      if (x == n)
        printf("-1 ");
      else
        printf("%d ", x + 1);
    }
    printf("\n");
  }
  return 0;
}
