#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long INF = LLONG_MAX / 2;
const long long N = 2e5 + 1;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> a(n + 1);
    for (long long i = 1; i < n + 1; i++) cin >> a[i];
    vector<long long> d(n + 1), ans(n + 1, -1), l(n + 1);
    for (long long i = 1; i < n + 1; i++) {
      d[a[i]] = max(d[a[i]], i - l[a[i]]);
      l[a[i]] = i;
    }
    for (long long i = 1; i < n + 1; i++) d[i] = max(d[i], n + 1 - l[i]);
    for (long long i = 1; i < n + 1; i++)
      for (long long j = d[i]; j <= n && ans[j] == -1; j++) ans[j] = i;
    for (long long i = 1; i < n + 1; i++) cout << ans[i] << " ";
    cout << '\n';
  }
  return 0;
}
