#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
const long long N = 3e5 + 5;
long long n;
long long a[N], ans[N];
template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v) {
  for (auto it : v) os << it.first << " : " << it.second << "\n";
  return os;
}
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    cin >> n;
    map<long long, vector<long long> > mp;
    for (long long i = 1; i <= n; i++) {
      cin >> a[i];
      mp[a[i]].push_back(i);
    }
    vector<long long> pref(n + 5, INF);
    for (auto it : mp) {
      it.second.push_back(0);
      it.second.push_back(n + 1);
      sort(it.second.begin(), it.second.end());
      long long mx = 0;
      for (long long i = 0; i + 1 < it.second.size(); i++)
        mx = max(mx, it.second[i + 1] - it.second[i]);
      pref[mx] = min(pref[mx], it.first);
    }
    for (long long i = 1; i <= n; i++) pref[i] = min(pref[i], pref[i - 1]);
    for (long long i = 1; i <= n; i++) {
      if (pref[i] == INF)
        ans[i] = -1;
      else
        ans[i] = pref[i];
    }
    for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
    cout << endl;
  }
  return 0;
}
