#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int32_t main() {
  ios::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> v(n);
    vector<vector<long long>> r(n);
    for (long long i = 0; i < n; i++) {
      cin >> v[i];
      v[i]--;
      r[v[i]].push_back(i);
    }
    vector<long long> ans(n + 2, n + n);
    for (long long i = 0; i < n; i++) {
      long long p = -1;
      long long ma = 0;
      for (auto pos : r[i]) {
        ma = max(ma, pos - p);
        p = pos;
      }
      ma = max(ma, n - p);
      ans[ma] = min(ans[ma], i);
    }
    long long res = n + n;
    for (long long i = 1; i <= n; i++) {
      res = min(res, ans[i]);
      if (res > n)
        cout << "-1 ";
      else
        cout << res + 1 << " ";
    }
    cout << "\n";
  }
}
