#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC optimize(3, "Ofast", "inline")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
const double esp = 1e-6, pi = acos(-1);
const int N = 1e6 + 10, INF = 0x3f3f3f3f, mod = 1e9 + 7;
int work() {
  int n;
  cin >> n;
  vector<vector<int>> v(n);
  vector<int> ans(n + 1, INF);
  for (int i = 1; i <= n; i++) {
    int first;
    cin >> first;
    v[first - 1].push_back(i - 1);
  }
  for (int i = 0; i < n; i++) {
    if (!v[i].size()) continue;
    int mx = v[i][0];
    for (int j = 1; j < v[i].size(); j++)
      mx = max(mx, v[i][j] - v[i][j - 1] - 1);
    mx = max(mx, n - 1 - v[i].back());
    ans[mx + 1] = min(ans[mx + 1], i + 1);
  }
  for (int i = 1; i < n; i++) ans[i + 1] = min(ans[i + 1], ans[i]);
  for (int i = 1; i <= n; i++)
    if (ans[i] == INF)
      cout << -1 << " ";
    else
      cout << ans[i] << " ";
  puts("");
  return 0;
}
int main() {
  int n;
  cin >> n;
  while (n--) work();
  return 0;
}
