#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Vi = std::vector<int>;
using Vl = std::vector<ll>;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;
constexpr int I_INF = std::numeric_limits<int>::max();
constexpr ll L_INF = std::numeric_limits<ll>::max();
template <typename T1, typename T2>
inline bool chmin(T1& a, const T2& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, const T2& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
class Prints {
 private:
  class __Prints {
   public:
    __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
    template <class... Args>
    void operator()(const Args&... args) const {
      print(args...);
    }
    template <typename T>
    void pvec(const T& vec, size_t sz) const {
      for (size_t i = 0; i < sz; i++)
        std::cout << vec[i] << (i == sz - 1 ? term : sep);
    }
    template <typename T>
    void pmat(const T& mat, size_t h, size_t w) {
      for (size_t i = 0; i < h; i++)
        for (size_t j = 0; j < w; j++)
          std::cout << mat[i][j] << (j == w - 1 ? term : sep);
    }

   private:
    const char *sep, *term;
    void print() const { std::cout << term; }
    void print_rest() const { std::cout << term; }
    template <class T, class... Tail>
    void print(const T& head, const Tail&... tail) const {
      std::cout << head, print_rest(tail...);
    }
    template <class T, class... Tail>
    void print_rest(const T& head, const Tail&... tail) const {
      std::cout << sep << head, print_rest(tail...);
    }
  };

 public:
  Prints() {}
  __Prints operator()(const char* sep = " ", const char* term = "\n") const {
    return __Prints(sep, term);
  }
};
Prints prints;
inline void solve_one() {
  int N;
  cin >> N;
  Vi A(N);
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<Vi> pos(N + 1, Vi(1, 0));
  for (ll i = 0; i < N; i++) {
    pos[A[i]].emplace_back(i + 1);
  }
  for (ll i = 1; i <= N; i++) {
    pos[i].emplace_back(N + 1);
  }
  Vi mxs(N + 1);
  for (ll i = 1; i <= N; i++) {
    int sz = (int)pos[i].size();
    int mx = 0;
    for (ll j = 0; j < sz - 1; j++) {
      chmax(mx, pos[i][j + 1] - pos[i][j]);
    }
    mxs[i] = mx;
  }
  vector<Vi> vec(N + 2);
  for (ll i = 1; i <= N; i++) {
    vec[mxs[i]].emplace_back(i);
  }
  int cur = I_INF;
  for (ll i = 1; i <= N; i++) {
    if (vec[i].empty())
      if (cur != I_INF)
        cout << cur << " ";
      else
        cout << -1 << " ";
    else {
      chmin(cur, vec[i][0]);
      if (cur != I_INF)
        cout << cur << " ";
      else
        cout << -1 << " ";
    }
  }
  cout << "\n";
}
void solve() {
  int Q;
  cin >> Q;
  while (Q--) solve_one();
}
int main() {
  std::cin.tie(nullptr), std::cout.tie(nullptr);
  std::ios::sync_with_stdio(false);
  std::cout << std::setprecision(18) << std::fixed;
  solve();
  std::cout << std::flush;
  return 0;
}
