#include <bits/stdc++.h>
using namespace std;
template <class T>
string tostring(T x) {
  ostringstream out;
  out << x;
  return out.str();
}
long long toint(string s) {
  istringstream in(s);
  long long x;
  in >> x;
  return x;
}
int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[8] = {1, -1, 0, 0, -1, 1, -1, 1};
int kx[8] = {1, 1, -1, -1, 2, 2, -2, -2};
int ky[8] = {2, -2, 2, -2, 1, -1, 1, -1};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solveOne() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<vector<int>> b(n + 1);
  set<int> s;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[a[i]].push_back(i);
    s.insert(a[i]);
  }
  vector<int> ans(n, -1);
  for (auto x : s) {
    int dist = max(b[x][0] + 1, n - b[x].back());
    for (int i = 0; i + 1 < b[x].size(); i++) {
      dist = max(dist, b[x][i + 1] - b[x][i]);
    }
    for (int j = dist - 1; j <= n; j++)
      if (ans[j] == -1)
        ans[j] = x;
      else
        break;
  }
  for (auto x : ans) cout << x << " ";
  cout << endl;
}
int main() {
  std::ios::sync_with_stdio(false);
  int T = 1;
  cin >> T;
  while (T--) {
    solveOne();
  }
  return 0;
}
