#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265358979323846;
long long MOD = 1e9 + 7;
const char nl = '\n';
const long long inf = 1e15;
long long power(long long x, long long y) {
  long long z = 1;
  while (y > 0) {
    if (y % 2) z = z * x;
    x = x * x;
    y /= 2;
  }
  return z;
}
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long sq(long long a) {
  long long ans = (1ll * a * a);
  return ans;
}
bool isprime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long digitsum(long long x) {
  long long ans = 0;
  while (x > 0) {
    ans += (x % 10);
    x /= 10;
  }
  return ans;
}
void solve() {
  int n;
  cin >> n;
  int a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<int>> freq(n + 1);
  for (long long i = 0; i < n; i++) {
    freq[a[i]].push_back(i + 1);
  }
  for (long long i = 0; i < n + 1; i++) {
    freq[i].push_back(0);
    freq[i].push_back(n + 1);
  }
  int ar[n + 1];
  for (int i = 0; i <= n; i++) {
    ar[i] = INT_MAX;
  }
  for (int i = 1; i <= n; i++) {
    if (freq[i].size() > 2) {
      int temp = 0;
      sort(freq[i].begin(), freq[i].end());
      for (long long j = 0; j < freq[i].size() - 1; j++) {
        temp = max(temp, freq[i][j + 1] - freq[i][j]);
      }
      ar[temp] = min(ar[temp], i);
    }
  }
  for (int i = 1; i <= n; i++) {
    ar[i] = min(ar[i], ar[i - 1]);
  }
  for (int i = 1; i <= n; i++) {
    if (ar[i] == INT_MAX) {
      cout << -1 << " ";
    } else {
      cout << ar[i] << " ";
    }
  }
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long TC = 1;
  cin >> TC;
  while (TC--) {
    solve();
  }
}
