#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) cin >> a[i];
    vector<long long> ans(n + 1, -1);
    map<long long, vector<long long>> m;
    for (int i = 0; i < n; i++) {
      m[a[i]].push_back(i);
    }
    for (auto i : m) {
      long long f = i.first;
      vector<long long> s = i.second;
      s.push_back(n);
      long long p = -1, q = 0;
      for (int i = 0; i < s.size(); i++) {
        q = max(q, s[i] - p);
        p = s[i];
      }
      for (int i = q; i <= n && ans[i] == -1; i++) {
        ans[i] = f;
      }
    }
    for (int i = 1; i <= n; i++) cout << ans[i] << " ";
    cout << endl;
  }
  return 0;
}
