#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> vec(n + 1);
    for (int i = 1; i <= n; i++) cin >> vec[i];
    vector<int> f(n + 1, 0), last(n + 1, 0), ans(n + 1, -1);
    for (int i = 1; i <= n; i++) {
      int x = vec[i];
      f[x] = max(f[x], i - last[x]);
      last[x] = i;
    }
    for (int x = 1; x <= n; x++) {
      f[x] = max(f[x], n + 1 - last[x]);
      for (int i = f[x]; i <= n && ans[i] == -1; i++) ans[i] = x;
    }
    for (int i = 1; i <= n; i++) cout << ans[i] << " ";
    cout << '\n';
  }
}
