#include <bits/stdc++.h>
using namespace std;
long long mod;
long long gcd(long long a, long long b) {
  return a % b == 0 ? b : gcd(b, a % b);
}
long long pow(long long a, long long b) {
  long long an = 1;
  long long base = a % mod;
  while (b > 0) {
    if (b & 1 != 0) {
      an = (an * base) % mod;
    }
    base = (base * base) % mod;
    b >>= 1;
  }
  return an % mod;
}
long long inv(long long a) { return pow(a, mod - 2); }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long Arithmetic(long long a1, long long n, long long d) {
  long long sum = 0;
  sum += n * a1;
  sum %= mod;
  long long temp = n * (n - 1);
  temp %= mod;
  temp *= d;
  temp %= mod;
  temp /= 2;
  temp %= mod;
  return (sum + temp) % mod;
}
long long euler(long long n) {
  long long ans = n;
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) {
      ans = ans - ans / i;
      while (n % i == 0) n /= i;
    }
  if (n > 1) ans = ans - ans / n;
  return ans;
}
void release_que(queue<long long> q) {
  while (!q.empty()) {
    q.pop();
  }
  return;
}
double fabs(double a) {
  if (a >= 0) {
    return a;
  }
  return -a;
}
double Newtonsqrt(double n, double errors) {
  if (n < 0) {
    return -1;
  }
  double root = n;
  while (fabs(n - root * root) >= errors) {
    root = (n / root + root) / 2.0;
  }
  return root;
}
bool cmp(long long a, long long b) { return a > b; }
long long a[300010];
long long ans[300010];
long long dis[300010], last[300010];
int main(void) {
  long long t;
  scanf("%lld", &t);
  while (t--) {
    memset(last, -1, sizeof(last));
    memset(dis, -1, sizeof(dis));
    long long n;
    scanf("%lld", &n);
    for (long long i = 0; i < n; i++) {
      scanf("%lld", a + i);
      dis[a[i]] = max(dis[a[i]], i - last[a[i]] + 1);
      last[a[i]] = i;
    }
    for (long long i = 0; i < n + 10; i++) {
      ans[i] = 0x3f3f3f3f;
    }
    for (long long i = 0; i < n; i++) {
      dis[a[i]] = max(dis[a[i]], n - last[a[i]] + 1);
    }
    for (long long i = 0; i < n; i++) {
      ans[dis[a[i]]] = min(ans[dis[a[i]]], a[i]);
    }
    for (long long i = 0; i < n; i++) {
      ans[dis[a[i]]] = min(ans[dis[a[i]]], a[i]);
    }
    long long mi = 0x3f3f3f3f;
    for (long long i = 2; i <= n + 1; i++) {
      ans[i] = min(mi, ans[i]);
      mi = ans[i];
    }
    for (long long i = 2; i <= n + 1; i++) {
      if (ans[i] == 0x3f3f3f3f) {
        ans[i] = -1;
      } else {
        break;
      }
    }
    for (long long i = 1; i <= n; i++) {
      printf("%lld ", ans[i + 1] == 0x3f3f3f3f ? -1 : ans[i + 1]);
    }
    printf("\n");
  }
  return 0;
}
