#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long pre[300005], mx[300005], ans[300005];
void solve() {
  long long i, j, k, l, r, m, n, a, b, c, d, x, y, z, t;
  cin >> n;
  for (i = 0; i <= n; i++) ans[i] = mx[i] = pre[i] = 0;
  for (i = 1; i <= n; i++) {
    cin >> x;
    mx[x] = max(mx[x], i - pre[x]);
    pre[x] = i;
  }
  for (i = 1; i <= n; i++) {
    mx[i] = max(mx[i], n + 1 - pre[i]);
  }
  long long cur = 1;
  for (i = n; i >= 1; i--) {
    while (mx[cur] > i) cur++;
    if (cur <= n)
      ans[i] = cur;
    else
      ans[i] = -1;
  }
  for (i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << endl;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
