#include <bits/stdc++.h>
using namespace std;
namespace STDquantum {
template <typename T>
inline void read(T &x) {
  char ch;
  int f = 1;
  while (ch = getchar(), !isdigit(ch))
    if (ch == '-') f = -1;
  x = (ch ^ 48);
  while (ch = getchar(), isdigit(ch)) x = x * 10 + (ch ^ 48);
  x *= f;
}
template <typename T>
inline void write(T x) {
  static int stk[100], top = 0;
  if (x == 0) return (void)putchar('0');
  if (x < 0) x = -x, putchar('-');
  while (x) stk[++top] = x % 10, x /= 10;
  while (top) putchar(stk[top--] + '0');
}
inline void max(int &x, const int &y) { x = x < y ? y : x; }
inline void min(int &x, const int &y) { x = x > y ? y : x; }
const int N = 3e5 + 10, inf = 0x3f3f3f3f;
int t, n, a[N], las[N], maxx[N], pos[N];
inline void main() {
  for (read(t); t--;) {
    read(n);
    memset(las, 0, sizeof(las));
    memset(pos, 0x3f, sizeof(pos));
    memset(maxx, 0, sizeof(maxx));
    for (int i = 1; i <= n; ++i) {
      read(a[i]);
      max(maxx[a[i]], i - las[a[i]]);
      las[a[i]] = i;
    }
    for (int i = 1; i <= n; ++i) max(maxx[a[i]], n + 1 - las[a[i]]);
    for (int i = 1; i <= n; ++i) min(pos[maxx[a[i]]], a[i]);
    for (int i = 1; i <= n; ++i) {
      min(pos[i], pos[i - 1]);
      write(pos[i] == inf ? -1 : pos[i]), putchar(' ');
    }
    putchar('\n');
  }
}
}  // namespace STDquantum
int main() {
  STDquantum::main();
  return 0;
}
