#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void solveTestCase() {
  int n;
  cin >> n;
  int a[n];
  int ans[n];
  set<int> s;
  vector<vector<int>> v(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    v[a[i]].push_back(i);
    s.insert(a[i]);
    ans[i] = -1;
  }
  for (auto i = s.begin(); i != s.end(); i++) {
    int maxGap = -1;
    int start = -1;
    for (int j = 0; j < v[(*i)].size(); j++) {
      maxGap = max(maxGap, v[(*i)][j] - start);
      start = v[(*i)][j];
    }
    maxGap = max(maxGap, n - start);
    for (int j = maxGap - 1; j < n; j++) {
      if (ans[j] != -1) {
        break;
      }
      ans[j] = *i;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solveTestCase();
  }
}
