#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, ans;
  cin >> n;
  int arr[n];
  ans = n + 1;
  vector<int> v[n + 1];
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    v[x].push_back(i);
    arr[i] = n + 1;
  }
  for (int i = 1; i <= n; i++) {
    if (v[i].size() == 0) continue;
    int m = -1;
    for (int j = 0; j < v[i].size(); j++) {
      if (j == 0) {
        m = max(m, v[i][j]);
      }
      if (j == v[i].size() - 1) {
        m = max(m, n - v[i][j] + 1);
      }
      if (j > 0) {
        m = max(m, v[i][j] - v[i][j - 1]);
      }
    }
    arr[m] = min(arr[m], i);
  }
  for (int i = 1; i <= n; i++) {
    ans = min(ans, arr[i]);
    if (ans == n + 1)
      cout << "-1 ";
    else
      cout << ans << " ";
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
