#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long binpow(long long a, long long b, long long mod) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res % mod;
}
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const int N = 3e5 + 5;
const long long inf = 1e16;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  vector<int> pos[n + 1];
  set<int> s;
  for (int i = 1; i <= n; i++) pos[i].push_back(0);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]].push_back(i);
    s.insert(a[i]);
  }
  int ans[n + 1];
  for (int i = 1; i <= n; i++) ans[i] = -1;
  map<int, int> mn;
  for (auto x : s) {
    int mx = INT_MIN;
    for (int j = 1; j < pos[x].size(); j++) {
      mx = max(mx, pos[x][j] - pos[x][j - 1]);
    }
    mx = max(mx, n - pos[x].back() + 1);
    for (int i = mx; i <= n and ans[i] == -1; i++) ans[i] = x;
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
