#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a;
    for (int e = 0; e < n; e++) {
      int y;
      cin >> y;
      a.push_back(y);
    };
    map<int, vector<int> > m;
    for (int i = 0; i < n; i++) {
      m[a[i]].push_back(i);
    }
    vector<int> res(n, -1);
    for (auto it = m.begin(); it != m.end(); it++) {
      int maxD = INT_MIN, fe = it->second[0],
          le = it->second[it->second.size() - 1];
      for (int i = 1; i < it->second.size(); i++) {
        maxD = max(maxD, it->second[i] - it->second[i - 1]);
      }
      maxD = max(fe + 1, max(n - le, maxD));
      if (res[maxD - 1] == -1) res[maxD - 1] = it->first;
    }
    int p = INT_MAX;
    for (int i = 0; i < n; i++) {
      if (res[i] > 0) {
        res[i] = min(p, res[i]);
        p = res[i];
      } else if (res[i] < 0 and p != INT_MAX) {
        res[i] = p;
      }
    }
    for (auto it = res.begin(); it != res.end(); it++) cout << *it << ' ';
    cout << '\n';
  }
}
