#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    map<long long, vector<long long>> ma;
    vector<long long> v(n + 1);
    for (long long i = 1; i <= (n); ++i) {
      cin >> v[i];
      ma[v[i]].push_back(i);
    }
    vector<long long> res(n + 1, INF);
    for (auto it : ma) {
      vector<long long> a = it.second;
      long long sz = a.size();
      long long ans = max(a[0], n - a[sz - 1] + 1);
      for (long long i = 1; i < sz; i++) {
        ans = max(ans, a[i] - a[i - 1]);
      }
      res[ans] = min(res[ans], it.first);
    }
    for (long long i = 2; i <= n; i++) res[i] = min(res[i], res[i - 1]);
    for (long long i = 1; i <= n; i++) {
      if (res[i] >= INF)
        cout << -1 << " ";
      else
        cout << res[i] << " ";
    }
    cout << '\n';
  }
  return 0;
}
