#include <bits/stdc++.h>
using namespace std;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<vector<int> > pos(n, {-1});
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    pos[a[i] - 1].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    pos[i].push_back(n);
    42;
  }
  vector<int> mx(n, -1e9);
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < pos[i].size(); j++) {
      mx[i] = max(mx[i], pos[i][j] - pos[i][j - 1] - 1);
    }
  }
  int pt = 0;
  vector<int> ans(n + 1);
  for (int i = n; i >= 1; i--) {
    while (pt < n && mx[pt] >= i) pt++;
    assert(pt == n || mx[pt] < i);
    ans[i] = pt >= n ? -1 : pt + 1;
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
