#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
void solve() {
  int n;
  scanf("%d", &n);
  vector<vector<int>> vec(n);
  for (int i = 0; i < n; i++) {
    vec[i].push_back(-1);
  }
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    a--;
    vec[a].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    vec[i].push_back(n);
  }
  vector<int> stark(n + 1, INF + 1);
  for (int i = 0; i < n; i++) {
    if ((int)vec[i].size() <= 2) continue;
    int gap = 0;
    for (int j = 1; j < (int)vec[i].size(); j++) {
      gap = max(gap, vec[i][j] - vec[i][j - 1]);
    }
    stark[gap] = min(stark[gap], i + 1);
  }
  vector<int> res;
  int mn = INF;
  for (int i = 1; i <= n; i++) {
    mn = min(mn, stark[i]);
    if (mn >= INF)
      res.push_back(-1);
    else
      res.push_back(mn);
  }
  for (int i = 0; i < n; i++) {
    if (i) printf(" ");
    printf("%d", res[i]);
  }
  printf("\n");
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int T;
  scanf("%d", &T);
  while (T--) {
    solve();
  }
  return 0;
}
