#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5;
long long n;
long long a[N], ans[N];
vector<long long> pos[N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (long long i = 1; i <= n; i++) pos[i].clear();
    for (long long i = 1; i <= n; i++) {
      cin >> a[i];
      ans[i] = 1e9;
      pos[a[i]].push_back(i);
    }
    for (long long i = 1; i <= n; i++) {
      if (!pos[i].size()) continue;
      long long diff = max(pos[i][0], n + 1 - pos[i].back());
      for (long long j = 0; j + 1 < pos[i].size(); j++)
        diff = max(diff, pos[i][j + 1] - pos[i][j]);
      ans[diff] = min(ans[diff], i);
    }
    for (long long i = 1; i <= n; i++) {
      if (i >= 2) ans[i] = min(ans[i], ans[i - 1]);
      long long cur = ans[i];
      if (cur == 1e9) cur = -1;
      cout << cur << " ";
    }
    cout << "\n";
  }
  return 0;
}
