#include <bits/stdc++.h>
using namespace std;
int f[300005], g[300005], ans[300005];
void solve() {
  int n, u;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    f[i] = g[i] = 0;
    ans[i] = -1;
  }
  for (int i = 1; i <= n; i++) {
    cin >> u;
    f[u] = max(f[u], i - g[u]);
    g[u] = i;
  }
  for (int i = 1; i <= n; i++) {
    f[i] = max(f[i], n - g[i] + 1);
    for (int j = f[i]; j <= n && ans[j] == -1; j++) ans[j] = i;
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
}
