#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<vector<int>> where(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      a[i]--;
      where[a[i]].push_back(i);
    }
    vector<int> ans(n + 1, -1);
    int next = n;
    for (int val = 0; val < n; val++) {
      int dist = -1;
      int prev = -1;
      where[val].push_back(n);
      for (int pos : where[val]) {
        dist = max(dist, pos - prev);
        prev = pos;
      }
      while (dist <= next && next >= 1) {
        ans[next] = val + 1;
        next--;
      }
    }
    for (int i = 1; i <= n; i++) cout << ans[i] << " ";
    cout << endl;
  }
  return 0;
}
