#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 1e5;
void runcases(long long int T) {
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
  }
  vector<long long int> left(n, 1e15);
  vector<long long int> right(n, 1e15);
  map<long long int, long long int> mp;
  for (long long int i = 0; i < n; i++) {
    long long int l = -1;
    if (mp.count(v[i])) {
      l = mp[v[i]];
    }
    long long int dist = (i - l);
    left[i] = dist;
    mp[v[i]] = i;
  }
  mp.clear();
  for (long long int i = n - 1; i >= 0; i--) {
    long long int l = n;
    if (mp.count(v[i])) {
      l = mp[v[i]];
    }
    long long int dist = (l - i);
    right[i] = dist;
    mp[v[i]] = i;
  }
  map<long long int, long long int> mpres;
  for (long long int i = 0; i < n; i++) {
    long long int maxel = max(left[i], right[i]);
    mpres[v[i]] = max(maxel, mpres[v[i]]);
  }
  vector<long long int> res(n + 1, 1e15);
  for (long long int i = n; i >= 1; i--) {
    if (!mpres.count(i)) {
      continue;
    }
    long long int len = mpres[i];
    res[len] = min(res[len], i);
  }
  long long int minel = 1e15;
  for (long long int i = 1; i <= n; i++) {
    minel = min(minel, res[i]);
    res[i] = minel;
    if (res[i] == 1e15) {
      res[i] = -1;
    }
    cout << res[i] << " ";
  }
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T = 1;
  cin >> T;
  for (long long int t = 1; t <= T; t++) {
    runcases(t);
  }
  return 0;
}
