#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int A[n];
  vector<int> B[n + 1];
  for (int i = 1; i <= n; i++) {
    B[i].push_back(-1);
  }
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    B[A[i]].push_back(i);
  }
  int ans[n];
  for (int i = 1; i <= n; i++) {
    ans[i] = 1e9;
    B[i].push_back(n);
  }
  for (int i = 1; i <= n; i++) {
    int mini = 0;
    for (int j = 0; j + 1 < B[i].size(); j++) {
      mini = max(mini, B[i][j + 1] - B[i][j]);
    }
    ans[mini] = min(ans[mini], i);
  }
  int val = 1e9;
  for (int i = 1; i <= n; i++) {
    val = min(val, ans[i]);
    if (val == 1e9) {
      cout << "-1 ";
    } else {
      cout << val << " ";
    }
  }
  cout << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
