#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
template <typename T, typename... Args>
void read(T &first, Args &...args) {
  read(first);
  read(args...);
}
template <typename T>
void write(T arg) {
  T x = arg;
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
}
template <typename T, typename... Ts>
void write(T arg, Ts... args) {
  write(arg);
  if (sizeof...(args) != 0) {
    putchar(' ');
    write(args...);
  }
}
const int N = 3e5 + 50;
vector<int> v[N];
int T, n, t, ans[N];
int main() {
  read(T);
  while (T--) {
    read(n);
    for (int i = 1; i <= n + 2; ++i) {
      ans[i] = -1;
      v[i].clear();
      v[i].push_back(0);
    }
    for (int i = 1; i <= n; ++i) {
      read(t);
      v[t].push_back(i);
    }
    int flag = 0x3f3f3f3f;
    for (int i = 1; i < n + 2; ++i) {
      v[i].push_back(n + 1);
      int c = 0;
      for (int j = 0; j < v[i].size() - 1; ++j) {
        c = max(v[i][j + 1] - v[i][j], c);
      }
      if (ans[c] == -1) {
        ans[c] = i;
      } else {
        ans[c] = min(ans[c], i);
      }
    }
    for (int i = 1; i <= n; ++i) {
      if (ans[i] == -1) {
        if (flag != 0x3f3f3f3f) {
          printf("%d ", flag);
        } else {
          printf("-1 ");
        }
      } else {
        flag = min(flag, ans[i]);
        printf("%d ", flag);
      }
    }
    printf("\n");
  }
  return 0;
}
