#include <bits/stdc++.h>
using namespace std;
int n, t;
int a[300005], mat[300005], loc[300005], wz[300005];
int main() {
  scanf("%d", &t);
  while (t--) {
    memset(mat, 0, sizeof(mat));
    memset(loc, 0, sizeof(loc));
    memset(wz, 0, sizeof(wz));
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++) {
      if (mat[a[i]] < i - loc[a[i]]) mat[a[i]] = i - loc[a[i]];
      loc[a[i]] = i;
    }
    for (int i = 1; i <= n; i++) mat[a[i]] = max(mat[a[i]], n - loc[a[i]] + 1);
    for (int i = 1; i <= n; i++)
      if (!wz[mat[i]]) wz[mat[i]] = i;
    int ans = -1;
    for (int i = 1; i <= n; i++) {
      if (wz[i] == 0 && ans == -1) {
        printf("-1 ");
        continue;
      }
      if (ans == -1) {
        ans = wz[i];
        printf("%d ", ans);
        continue;
      }
      if (wz[i] == 0) {
        printf("%d ", ans);
        continue;
      }
      ans = min(ans, wz[i]);
      printf("%d ", ans);
    }
    puts(" ");
  }
  return 0;
}
