#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long MAXN = 3e5 + 6;
const long long MAXM = 1e5 + 6;
int a[MAXN], n;
vector<int> v[MAXN];
int ans[MAXN];
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) v[i].clear();
  for (int i = 1; i <= n; i++) ans[i] = INF;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    v[a[i]].push_back(i);
  }
  int last = n;
  for (int i = 0; i <= n; i++) {
    if (v[i].size() == 0)
      continue;
    else {
      int k = v[i][0];
      for (int j = 1; j < v[i].size(); j++) {
        k = max(k, v[i][j] - v[i][j - 1]);
      }
      k = max(k, n - v[i].back() + 1);
      for (int l = k; l <= last; l++) {
        ans[l] = i;
      }
      last = min(last, k - 1);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (ans[i] == INF)
      cout << "-1 ";
    else
      cout << ans[i] << " ";
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) solve();
  return 0;
}
