#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
void FILE_IO() {
  freopen("output.txt", "w", stdout);
  freopen("input.txt", "r", stdin);
}
int tt, n;
int ans[N];
int f[N];
int last[N];
int a[N];
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    f[i] = last[i] = 0;
    ans[i] = -1;
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    f[a[i]] = max(f[a[i]], i - last[a[i]]);
    last[a[i]] = i;
  }
  for (int x = 1; x <= n; x++) {
    f[x] = max(f[x], n - last[x] + 1);
    for (int i = f[x]; i <= n && ans[i] == -1; i++) {
      ans[i] = x;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " \n"[i == n];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> tt;
  while (tt--) {
    solve();
  }
}
