#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    vector<long long> v[n + 1];
    for (long long i = 1; i < n + 1; i++) {
      v[i].push_back(-1);
    }
    for (long long i = 0; i < n; i++) v[a[i]].push_back(i);
    for (long long i = 1; i < n + 1; i++) {
      v[i].push_back(n);
    }
    long long ma[n + 1];
    for (long long i = 1; i < n + 1; i++) {
      long long mx = 0;
      for (long long j = 1; j < v[i].size(); j++)
        mx = max(mx, v[i][j] - v[i][j - 1]);
      ma[i] = mx;
    }
    long long ans[n];
    for (long long i = 0; i < n; i++) ans[i] = -1;
    for (long long i = 1; i < n + 1; i++) {
      for (long long j = ma[i] - 1; j < n; j++) {
        if (ans[j] != -1)
          break;
        else
          ans[j] = i;
      }
    }
    for (long long i = 0; i < n; i++) cout << ans[i] << " ";
    cout << endl;
  }
}
