#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n + 1], diff[n + 1], last[n + 1], ans[n + 1];
    for (long long int i = 1; i <= n; i++) {
      cin >> a[i];
      diff[i] = last[i] = 0;
      ans[i] = -1;
    }
    for (long long int i = 1; i <= n; i++) {
      long long int x = a[i];
      diff[x] = max(diff[x], i - last[x]);
      last[x] = i;
    }
    for (long long int i = 1; i <= n; i++) {
      diff[i] = max(diff[i], n - last[i] + 1);
      for (long long int j = diff[i]; j <= n and ans[j] == -1; j++) {
        ans[j] = i;
      }
    }
    for (long long int i = 1; i <= n; i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
