#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n, n1;
    cin >> n;
    n1 = n;
    long long int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<long long int> v[n + 1];
    map<long long int, long long int> m1;
    for (int i = 0; i < n; i++) {
      m1.insert({a[i], 0});
      v[a[i]].push_back(i);
    }
    sort(a, a + n);
    long long int ans[n];
    for (int i = 0; i < n; i++) ans[i] = -1;
    for (int i = 0; i < n1; i++) {
      if (m1.find(a[i]) != m1.end()) {
        long long int m = v[a[i]][0] + 1;
        for (int j = 1; j < v[a[i]].size(); j++) {
          if (v[a[i]][j] - v[a[i]][j - 1] > m) m = v[a[i]][j] - v[a[i]][j - 1];
        }
        if (n1 - v[a[i]][v[a[i]].size() - 1] > m)
          m = n1 - v[a[i]][v[a[i]].size() - 1];
        for (int i1 = m - 1; i1 < n; i1++)
          if (ans[i1] == -1) ans[i1] = a[i];
        m1.erase(a[i]);
        if (m == 1)
          break;
        else
          n = m - 1;
      }
    }
    for (int i = 0; i < n1; i++) cout << ans[i] << " ";
    cout << endl;
  }
}
