#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long msum(long long a, long long b, long long m) {
  return (a % m + b % m) % m;
}
long long msub(long long a, long long b, long long m) {
  return (a % m - b % m) % m;
}
long long mpro(long long a, long long b, long long m) {
  return ((a % m) * (b % m)) % m;
}
long long m_m(long long a, long long b, long long m);
long long fxp(long long a, long long b, long long m);
void swap(long long &a, long long &b) {
  long long t = a;
  a = b;
  b = t;
}
struct val {
  long long prev;
  long long mx;
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long n, i;
    cin >> n;
    long long v[n + 1];
    val vp[n + 1];
    map<long long, long long> m;
    long long res[n + 1];
    res[0] = INT_MAX;
    map<long long, bool> visited;
    for (i = 1; i <= n; i++) {
      cin >> v[i];
      vp[i].prev = 1;
      vp[i].mx = -1;
      m[v[i]]++;
      res[i] = INT_MAX;
      visited[v[i]] = false;
    }
    for (i = 1; i <= n; i++) {
      if (visited[v[i]] == false)
        vp[v[i]].mx = max(vp[v[i]].mx, i - vp[v[i]].prev + 1);
      else
        vp[v[i]].mx = max(vp[v[i]].mx, i - vp[v[i]].prev);
      vp[v[i]].prev = i;
      if (m[v[i]] == 1) {
        vp[v[i]].mx = max(vp[v[i]].mx, n - i + 1);
        vp[v[i]].prev = n;
      }
      visited[v[i]] = true;
      m[v[i]]--;
    }
    for (i = 1; i <= n; i++) {
      res[vp[v[i]].mx] = min(v[i], res[vp[v[i]].mx]);
    }
    for (i = 1; i <= n; i++) {
      res[i] = min(res[i - 1], res[i]);
    }
    for (i = 1; i <= n; i++) {
      if (res[i] == INT_MAX) {
        cout << -1 << " ";
      } else {
        cout << res[i] << " ";
      }
    }
    cout << "\n";
  }
  return 0;
}
long long fxp(long long a, long long b, long long m) {
  if (b == 0) return 1;
  if (b % 2 == 0) return fxp(m_m(a, a, m), b / 2, m);
  return m_m(fxp(a, b - 1, m), a, m);
}
long long m_m(long long a, long long b, long long m) {
  long long res = 0;
  a = a % m;
  while (b) {
    if (b & 1) {
      res += a;
      res = res % m;
    }
    a = (a * 2) % m;
    b = b / 2;
  }
  return res;
}
