#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(20) << fixed;
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n + 1];
    vector<long long> v[n + 1];
    for (long long i = 1; i <= n; i++) {
      cin >> a[i];
      v[i].push_back(0);
    }
    for (long long i = 1; i <= n; i++) v[a[i]].push_back(i);
    for (long long i = 1; i <= n; i++) v[i].push_back(n + 1);
    long long ans[n + 2];
    for (long long i = 0; i < n + 2; i++) ans[i] = n + 2;
    for (long long i = 1; i <= n; 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]);
      ans[mx] = min(ans[mx], i);
    }
    long long x = n + 2;
    for (long long i = 1; i <= n; i++) {
      x = min(x, ans[i]);
      if (x == n + 2)
        cout << -1 << " ";
      else
        cout << x << " ";
    }
    cout << endl;
  }
  return 0;
}
