#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 300005;
int n;
int a[N];
vector<int> v[N];
int ans[N];
void solv() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) v[i].clear();
  for (int i = 1; i <= n; ++i) {
    v[a[i]].push_back(i);
  }
  for (int i = 1; i <= n; ++i) ans[i] = N;
  for (int i = 1; i <= n; ++i) {
    if (v[i].empty()) continue;
    int maxu = v[i][0] - 1;
    for (int j = 0; j < ((int)(v[i]).size()) - 1; ++j)
      maxu = max(maxu, v[i][j + 1] - v[i][j] - 1);
    maxu = max(maxu, n - v[i].back());
    ans[maxu + 1] = min(ans[maxu + 1], i);
  }
  for (int i = 2; i <= n; ++i) ans[i] = min(ans[i], ans[i - 1]);
  for (int i = 1; i <= n; ++i) {
    if (ans[i] == N)
      printf("-1 ");
    else
      printf("%d ", ans[i]);
  }
  printf("\n");
}
int main() {
  int tt;
  scanf("%d", &tt);
  while (tt--) solv();
  return 0;
}
