#include <bits/stdc++.h>
using namespace std;
long long log2(long long a) {
  long long x = 1;
  long long count = 0;
  while (x <= a) {
    x = x * 2;
    count++;
  }
  return count;
}
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n], prev[n], res[n], ans[n];
    for (long long i = 1; i <= n; i++) {
      prev[i] = 0;
      res[i] = -1;
    }
    for (long long i = 1; i <= n; i++) {
      cin >> a[i];
      ans[i] = -1;
    }
    for (long long i = 1; i <= n; i++) {
      long long x = a[i];
      if (res[x] == -1)
        res[x] = i - prev[x];
      else
        res[x] = max(res[x], i - prev[x]);
      prev[x] = i;
    }
    for (long long x = 1; x <= n; x++) {
      res[x] = max(res[x], n - prev[x] + 1);
      for (long long i = res[x]; i <= n && ans[i] == -1; i++) {
        ans[i] = x;
      }
    }
    for (long long i = 1; i <= n; i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
  }
}
