#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << p.first << " " << p.second;
  return os;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < (int)v.size(); i++) {
    os << v[i] << (i + 1 != (int)v.size() ? " " : "");
  }
  return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &in : v) is >> in;
  return is;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    map<int, int> prev;
    map<int, int> maxd;
    for (int i = 0; i < n; ++i) {
      int ai;
      cin >> ai;
      int diff = i + 1 - prev[ai];
      maxd[ai] = max(maxd[ai], diff);
      prev[ai] = i + 1;
    }
    int written = n;
    vector<int> ans(n, 1e9);
    for (auto [x, md] : maxd) {
      md = max(md, n + 1 - prev[x]);
      if (md == n + 1) continue;
      md--;
      for (int i = md; i < written; ++i) {
        ans[i] = x;
      }
      written = min(written, md);
    }
    for (int i = 0; i < n; ++i) {
      if (ans[i] == 1e9) ans[i] = -1;
      cout << ans[i] << " ";
    }
    cout << endl;
  }
}
