#include <bits/stdc++.h>
int lastPos[300005];
int ans[300005], a[300005];
int f[300005];
inline void rd(int& x) {
  x = 0;
  int ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    ;
  for (; isdigit(ch); ch = getchar()) {
    x = x * 10 + ch - '0';
  }
}
inline void write(int X) {
  if (X < 0) X = -X, putchar('-');
  if (X > 9) write(X / 10);
  putchar(X % 10 + '0');
}
namespace my {
inline int max(int x, int y) { return x > y ? x : y; }
inline int min(int x, int y) { return x < y ? x : y; }
}  // namespace my
int main() {
  int t, n;
  rd(t);
  while (t--) {
    rd(n);
    for (int i = 1; i <= n; i++) {
      lastPos[i] = f[i] = 0;
      ans[i] = 0x3f3f3f3f;
    }
    for (int i = 1; i <= n; i++) {
      rd(a[i]);
      f[a[i]] = my::max(f[a[i]], i - lastPos[a[i]]);
      lastPos[a[i]] = i;
    }
    for (int i = 1; i <= n; i++) {
      f[i] = my::max(f[i], n - lastPos[i] + 1);
      for (int j = f[i]; j <= n && ans[j] == 0x3f3f3f3f; j++) {
        ans[j] = i;
      }
    }
    for (int i = 1; i <= n; i++) {
      write(ans[i] == 0x3f3f3f3f ? -1 : ans[i]);
      putchar(' ');
    }
    putchar('\n');
  }
  return 0;
}
