#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t, n, i, j, k, l;
  cin >> t;
  for (l = 0; l < t; l++) {
    cin >> n;
    long long int a[n], ans[n + 1], mx;
    ans[0] = INT_MAX;
    map<long long int, vector<long long int> > v;
    map<long long int, vector<long long int> >::iterator it;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      v[a[i]].push_back(i);
      ans[i + 1] = INT_MAX;
    }
    for (it = v.begin(); it != v.end(); it++) {
      mx = (*it).second[0] + 1;
      for (j = 1; j < (*it).second.size(); j++)
        mx = max(mx, (*it).second[j] - (*it).second[j - 1]);
      mx = max(mx, n - (*it).second[(*it).second.size() - 1]);
      ans[mx] = min(ans[mx], (*it).first);
    }
    for (i = 1; i <= n; i++) ans[i] = min(ans[i], ans[i - 1]);
    for (i = 1; i <= n; i++) {
      if (ans[i] == INT_MAX)
        cout << "-1 ";
      else
        cout << ans[i] << " ";
    }
    cout << "\n";
  }
  return 0;
}
