#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
inline int read() {
  int weight = 0, symbol = 1;
  char in = getchar();
  while (!isdigit(in)) {
    if (in == '-') symbol = -1;
    in = getchar();
  }
  while (isdigit(in)) {
    weight = weight * 10 + in - '0';
    in = getchar();
  }
  return symbol * weight;
}
inline void write(int x) {
  int s[20], len = 0;
  if (x < 0) putchar('-'), x = -x;
  do s[++len] = x % 10, x /= 10;
  while (x);
  while (len) putchar('0' | s[len--]);
  putchar(32);
}
void Max(int &x, int y) { x = (y > x) ? y : x; }
int T, n;
int a[MAXN];
int Mx;
vector<int> pos[MAXN];
int Ans[MAXN];
void clearify() {
  for (int i = 1; i <= Mx; i++) pos[i].clear();
  for (int i = 1; i <= n; i++) Ans[i] = 0;
  Mx = 0;
}
signed main() {
  T = read();
  while (T--) {
    n = read();
    for (int i = 1; i <= n; i++) {
      a[i] = read(), pos[a[i]].push_back(i);
      Max(Mx, a[i]);
    }
    int pin = n + 1;
    for (int i = 1; i <= Mx; i++) {
      if (!pos[i].size()) continue;
      int res = 0, sz = pos[i].size();
      Max(res, pos[i][0]);
      for (int j = 1; j < sz; j++) Max(res, pos[i][j] - pos[i][j - 1]);
      Max(res, n + 1 - pos[i][sz - 1]);
      while (pin > res) Ans[--pin] = i;
    }
    for (int i = 1; i <= n; i++) write(Ans[i] ? Ans[i] : -1);
    putchar(10);
    clearify();
  }
  return 0;
}
