#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17 + 17;
const long long N = 3e5 + 17;
long long mod = 1e9 + 7;
void precalc() {}
void solve() {
  long long n;
  cin >> n;
  vector<long long> last(n + 1), mx(n + 1), ans(n + 1, INF);
  for (long long i = 1; i <= n; ++i) {
    long long a;
    cin >> a;
    mx[a] = max(mx[a], i - last[a]);
    last[a] = i;
  }
  for (long long i = 1; i <= n; ++i) {
    if (!mx[i]) continue;
    mx[i] = max(mx[i], n - last[i] + 1);
    ans[mx[i]] = min(ans[mx[i]], i);
  }
  for (long long i = 1; i <= n; ++i) {
    ans[i] = min(ans[i], ans[i - 1]);
    if (ans[i] == INF)
      cout << "-1 ";
    else
      cout << ans[i] << ' ';
  }
}
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << setprecision(10) << fixed;
  precalc();
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
