#include <bits/stdc++.h>
using namespace std;
const long long mx = 3e5 + 10;
long long f[mx], last[mx], arr[mx], ans[mx];
void solve() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    f[i] = last[i] = 0;
    ans[i] = -1;
  }
  for (long long i = 1; i <= n; i++) cin >> arr[i];
  for (long long i = 1; i <= n; i++) {
    long long x = arr[i];
    f[x] = max(f[x], i - last[x]);
    last[x] = i;
  }
  for (long long i = 1; i <= n; i++) {
    f[i] = max(f[i], n - last[i] + 1);
    for (long long j = f[i]; j <= n && ans[j] == -1; j++) ans[j] = i;
  }
  for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << "\n";
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) solve();
  return 0;
}
