#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
vector<int> V[N];
vector<int> M[N];
void solve();
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
}
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    V[x].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    if (V[i].empty()) continue;
    int prev = 0;
    int mx = 1;
    for (auto z : V[i]) mx = max(mx, z - prev), prev = z;
    mx = max(mx, n + 1 - prev);
    M[mx].push_back(i);
  }
  int ans = 1e9;
  for (int i = 1; i <= n; i++) {
    if (!M[i].empty()) ans = min(ans, M[i][0]);
    printf("%d ", ans == 1e9 ? -1 : ans);
  }
  puts("");
  for (int i = 0; i <= n; i++) {
    V[i].clear();
    V[i].shrink_to_fit();
    M[i].clear();
    M[i].shrink_to_fit();
  }
}
