#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5;
long long a[N], pre[N], f[N], ans[N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n, c = 0;
    cin >> n;
    for (long long i = 1; i <= n; i++) {
      cin >> a[i];
      f[i] = pre[i] = 0;
      ans[i] = -1;
    }
    for (long long i = 1; i <= n; i++) {
      long long x = a[i];
      f[x] = max(f[x], i - pre[x]);
      pre[x] = i;
    }
    for (long long x = 1; x <= n; x++) {
      f[x] = max(f[x], n - pre[x] + 1);
      for (long long i = f[x]; i <= n && ans[i] == -1; i++) {
        ans[i] = x;
      }
    }
    for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
    cout << "\n";
  }
  return 0;
}
