#include <bits/stdc++.h>
using namespace std;
void solve(void) {
  long long n;
  cin >> n;
  vector<long long> lpos(n + 1, 0), maxd(n + 1, -1);
  for (long long i = 1; i <= n; ++i) {
    long long temp;
    cin >> temp;
    maxd[temp] = max(maxd[temp], i - lpos[temp]);
    lpos[temp] = i;
  }
  vector<long long> ans(n + 2, INT_MAX);
  for (long long i = 1; i <= n; ++i) {
    maxd[i] = max(maxd[i], n + 1 - lpos[i]);
    ans[maxd[i]] = min(ans[maxd[i]], i);
  }
  long long val = INT_MAX;
  for (long long i = 1; i <= n; ++i) {
    val = min(val, ans[i]);
    if (val == INT_MAX)
      cout << "-1 ";
    else
      cout << val << " ";
  }
  cout << endl;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) solve();
}
