#include <bits/stdc++.h>
using namespace std;
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long double pii = 3.14159265359;
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001;
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int Test_case;
  cin >> Test_case;
  while (Test_case-- != 0) {
    int N;
    cin >> N;
    vector<int> v(N);
    unordered_map<int, int, custom_hash> dis, lf;
    for (int x = 0; x < (N); x++) {
      cin >> v[x];
      if (!dis.count(v[x])) {
        dis[v[x]] = x + 1;
      } else {
        ckmax(dis[v[x]], x - lf[v[x]]);
      }
      lf[v[x]] = x;
    }
    vector<pair<int, int> > res;
    for (auto& i : dis) {
      ckmax(i.second, N - lf[i.first]);
      res.push_back({i.first, i.second});
    }
    sort(res.begin(), res.end());
    reverse(res.begin(), res.end());
    vector<int> ans(N + 1, INT_MAX);
    for (auto& i : res) {
      ans[i.second] = i.first;
    }
    int mn = ans[1];
    for (int x = 1; x < (N + 1); x++) {
      ckmin(ans[x], mn);
      ckmin(mn, ans[x]);
    }
    ans.erase(ans.begin());
    for (auto& i : ans) {
      if (i == INT_MAX) i = -1;
      cout << i << ' ';
    }
    cout << nl;
  }
  return 0;
}
