#include <bits/stdc++.h>
using namespace std;
const int64_t Nmax = 1e9 + 7;
const int64_t mod = 1000000007;
vector<int64_t> prime;
int64_t is_power_of_two(int64_t a) { return a && (!(a & (a - 1))); }
int64_t isperfectsquare(int64_t a) {
  double b = sqrt(a);
  return (b - ceil(b) == 0);
}
int64_t pow(int64_t a, int64_t b, int64_t m) {
  a = a % m;
  int64_t res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a % m;
    }
    a = a * a % m;
    b = b / 2;
  }
  return res;
}
void seive(int64_t n) {
  bool isprime[n];
  memset(isprime, true, sizeof(isprime));
  prime.push_back(2);
  for (int64_t i = 3; i <= sqrt(n); i += 2) {
    if (isprime[i]) {
      for (int64_t j = i * i; j <= n; j += i) {
        isprime[j] = false;
      }
    }
  }
  for (int64_t i = 3; i <= n; i += 2) {
    if (isprime[i]) {
      prime.push_back(i);
    }
  }
}
void solve() {
  int64_t n, k, sma = INT_MAX;
  cin >> n;
  map<int64_t, vector<int64_t>> mp;
  vector<int64_t> b(n), a(n);
  for (int64_t i = 0; i < n; i++) {
    cin >> a[i];
  };
  for (int64_t i = 0; i <= n - 1; i++) {
    if (mp.find(a[i]) == mp.end()) {
      mp[a[i]].push_back(0);
    }
    mp[a[i]].push_back(i + 1);
  }
  for (auto &e : mp) {
    e.second.push_back(n + 1);
  }
  vector<int64_t> ans(n + 1, -1);
  for (auto e : mp) {
    int64_t mx = -1, prev = 0;
    for (auto f : e.second) {
      mx = max(mx, f - prev);
      prev = f;
    }
    if (ans[mx] != -1) {
      ans[mx] = min(ans[mx], e.first);
    } else {
      ans[mx] = e.first;
    }
  }
  int64_t i = 1;
  while (ans[i] == -1) {
    cout << ans[i] << " ";
    i++;
  }
  int64_t minn = ans[i];
  for (int64_t j = i; j <= n; j++) {
    if (ans[j] == -1) {
      cout << minn << " ";
    } else {
      if (ans[j] < minn) {
        minn = ans[j];
        cout << ans[j] << " ";
      } else {
        cout << minn << " ";
      }
    }
  }
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int64_t t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
