#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int b[n + 1];
  memset(b, -1, sizeof(b));
  int last[n + 1];
  memset(last, -1, sizeof(last));
  for (int i = 0; i < n; i++) {
    int idx = i + 1;
    if (b[a[i]] == -1) {
      b[a[i]] = i + 1;
      last[a[i]] = i + 1;
    } else {
      int dif = idx - last[a[i]];
      b[a[i]] = max(b[a[i]], dif);
      last[a[i]] = i + 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (last[i] != -1) {
      b[i] = max(b[i], n - last[i] + 1);
    }
  }
  int ans[n + 1];
  for (int i = 0; i <= n; i++) ans[i] = INT_MAX;
  for (int i = 1; i <= n; i++) ans[b[i]] = min(ans[b[i]], i);
  for (int i = 1; i <= n; i++) ans[i] = min(ans[i], ans[i - 1]);
  for (int i = 1; i <= n; i++)
    if (ans[i] == INT_MAX)
      cout << -1 << " ";
    else
      cout << ans[i] << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
