#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int mod = 1e9 + 7;
int get_value(int k, vector<int>& a) {
  set<int> aplicants;
  map<int, int> cnt;
  for (int i = 0; i < k; ++i) {
    cnt[a[i]]++;
    aplicants.insert(a[i]);
  }
  for (int i = k; i < a.size(); ++i) {
    cnt[a[i - k]]--;
    cnt[a[i]]++;
    if (cnt[a[i - k]] == 0) aplicants.erase(a[i - k]);
  }
  return (aplicants.size() > 0 ? *aplicants.begin() : -1);
}
int bins(vector<int>& a) {
  int l = 0, r = a.size(), mid;
  while (r - l > 1) {
    mid = (l + r) / 2;
    if (get_value(mid, a) != -1) {
      r = mid;
    } else {
      l = mid;
    }
  }
  return r;
}
int main() {
  cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    map<int, vector<int> > ids;
    for (int i = 0; i < n; ++i) {
      if (ids[a[i]].size() == 0) ids[a[i]].push_back(0);
      ids[a[i]].push_back(i + 1);
    }
    for (int i = 0; i < n; ++i) {
      if (ids[a[i]].back() != n) ids[a[i]].push_back(n + 1);
    }
    vector<int> ans(n + 2, 1e9 + 100);
    for (auto x : a) {
      if (ids[x].size() == 0) continue;
      int k = 0;
      for (int i = 1; i < ids[x].size(); ++i) {
        k = max(k, ids[x][i] - ids[x][i - 1]);
      }
      ans[k] = min(ans[k], x);
      ids[x].clear();
    }
    for (int i = 1; i <= n; ++i) {
      ans[i + 1] = min(ans[i], ans[i + 1]);
      if (ans[i] > 1e9) ans[i] = -1;
      cout << ans[i] << " ";
    }
    cout << "\n";
  }
  return 0;
}
