#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int m) {
  if (y == 0) return 1;
  long long int p = power(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
long long int nCr(long long int n, long long int r, long long int m) {
  if (r > n) return 0;
  long long int a = 1, b = 1, i;
  for (i = 0; i < r; i++) {
    a = (a * n) % m;
    --n;
  }
  while (r) {
    b = (b * r) % m;
    --r;
  }
  return (a * power(b, m - 2, m)) % m;
}
void solve() {
  int n;
  cin >> n;
  map<int, int> mp, last, ans;
  vector<int> v(n);
  for (int i = 1; i <= n; ++i) last[i] = -1;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    mp[v[i]] = max(mp[v[i]], i - last[v[i]]);
    last[v[i]] = i;
  }
  vector<int> vis(n + 1);
  for (int i = n - 1; i >= 0; --i) {
    if (!vis[v[i]]) mp[v[i]] = max(mp[v[i]], n - i);
    vis[v[i]] = 1;
  }
  for (int i = 0; i < n; ++i) {
    if (ans[mp[v[i]]] == 0) ans[mp[v[i]]] = v[i];
    ans[mp[v[i]]] = min(ans[mp[v[i]]], v[i]);
  }
  for (int i = 1; i <= n; ++i) {
    if (ans[i - 1] != 0) ans[i] = min(ans[i], ans[i - 1]);
    if (ans[i] == 0) ans[i] = ans[i - 1];
    if (ans[i] == 0)
      cout << -1 << " ";
    else
      cout << ans[i] << " ";
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
