#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;
    map<long long, vector<long long>> vect;
    map<long long, long long> mp;
    for (long long i = 1; i <= n; i++) {
      long long x;
      cin >> x;
      vect[x].push_back(i);
    }
    for (auto i : vect) {
      auto k = i.second;
      long long diff = k[0] - 1;
      for (long long j = 1; j < k.size(); j++) {
        diff = max(diff, k[j] - k[j - 1] - 1);
      }
      diff = max(diff, n - k.back());
      for (long long l = 1; l <= n; l++) {
        if (l + diff <= n and !mp.count(l + diff)) {
          mp[l + diff] = i.first;
        } else {
          break;
        }
      }
    }
    for (long long i = 1; i <= n; i++) {
      if (mp.count(i)) {
        cout << mp[i] << " ";
      } else {
        cout << -1 << " ";
      }
    }
    cout << '\n';
  }
  return 0;
}
