#include <bits/stdc++.h>
using namespace std;
long long int a[300005];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    map<long long int, vector<long long int>> adj;
    for (long long int i = 0; i < n; i++) cin >> a[i];
    for (long long int i = 0; i < n; i++) {
      if (!adj[a[i]].size()) adj[a[i]].push_back(0);
      adj[a[i]].push_back(i + 1);
    }
    for (auto it : adj) {
      adj[it.first].push_back(n + 1);
    }
    map<long long int, long long int, greater<long long int>> occ;
    for (auto it : adj) {
      long long int mx = -9000000000000000000;
      for (long long int j = 1; j < it.second.size(); j++) {
        mx = max(mx, it.second[j] - it.second[j - 1]);
      }
      occ[it.first] = mx;
    }
    map<long long int, long long int> sorted_occ;
    for (auto it : occ) {
      sorted_occ[it.second] = it.first;
    }
    long long int mn = 9000000000000000000;
    for (long long int i = 1; i <= n; i++) {
      if (!sorted_occ[i]) {
        if (mn == 9000000000000000000)
          cout << -1 << " ";
        else
          cout << mn << " ";
      } else {
        mn = min(sorted_occ[i], mn);
        cout << mn << " ";
      }
    }
    cout << "\n";
  }
  return 0;
}
