#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> seen;
  map<int, int> val;
  map<int, int> temp;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (seen[a[i]] < 1) {
      seen[a[i]] = i + 1;
      val[a[i]] = i + 1;
    } else {
      val[a[i]] = max(val[a[i]], (i + 1) - seen[a[i]]);
      seen[a[i]] = i + 1;
    }
    temp[a[i]] = (n - i);
  }
  vector<pair<int, int>> vtr;
  for (int i = 0; i < n; i++) {
    if (val[a[i]] != -1) {
      vtr.push_back({max(val[a[i]], temp[a[i]]), a[i]});
      val[a[i]] = -1;
    }
  }
  sort(vtr.begin(), vtr.end());
  int nxt = 0;
  int mn = 1e9;
  for (int i = 1; i <= n; i++) {
    while (vtr[nxt].first <= i && nxt < vtr.size()) {
      mn = min(mn, vtr[nxt].second);
      nxt += 1;
    }
    if (mn == 1e9)
      cout << "-1 ";
    else
      cout << mn << " ";
  }
  cout << endl;
}
int main() {
  int t;
  cin >> t;
  for (int tt = 0; tt < t; tt++) solve();
  return 0;
}
