#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int MOD = 1e9 + 7;
const int N = 1e6 + 10;
const ll INF = 9e18;
const int M = 1010;
int cnt[N];
int a[N];
int last[N];
int ans[N];
void solve() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) last[i] = 0, cnt[i] = 0, ans[i] = MOD;
  for (int i = 1; i <= n; ++i)
    cin >> a[i], cnt[a[i]] = max(cnt[a[i]], i - last[a[i]]), last[a[i]] = i;
  for (int i = 1; i <= n; ++i) cnt[i] = max(cnt[i], n - last[i] + 1);
  for (int i = 1; i <= n; ++i) {
    if (cnt[i] == n + 1) continue;
    ans[cnt[i]] = min(ans[cnt[i]], i);
  }
  ans[0] = MOD;
  for (int i = 1; i <= n; ++i) {
    ans[i] = min(ans[i], ans[i - 1]);
    if (ans[i] == MOD)
      cout << -1 << ' ';
    else
      cout << ans[i] << ' ';
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) solve();
}
