#include <bits/stdc++.h>
#pragma GCC optimize "trapv"
using namespace std;
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.push_back(x);
  return move(v);
}
template <typename T, typename... Args>
inline string arrStr(T arr, int n) {
  stringstream s;
  s << "[";
  for (int i = 0; i < n - 1; i++) s << arr[i] << ",";
  s << arr[n - 1] << "]";
  return s.str();
}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template <typename T>
inline void __evars_out_var(vector<T> val) {
  cerr << arrStr(val, val.size());
}
template <typename T>
inline void __evars_out_var(T* val) {
  cerr << arrStr(val, 10);
}
template <typename T>
inline void __evars_out_var(T val) {
  cerr << val;
}
inline void __evars(vector<string>::iterator it) { cerr << endl; }
template <typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
  __evars_out_var(a);
  cerr << "; ";
  __evars(++it, args...);
}
const long long N = 1e6 + 5;
bool prime[N + 1];
int dp[N + 1];
void sieve() {
  for (int i = 2; i * i <= N; i++) {
    for (int j = i * i; j <= N; j += i) {
      if (prime[j]) {
        prime[j] = false;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  clock_t clk = clock();
  int t = 1;
  cin >> t;
  long long sum = 0;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> a(n);
    for (auto& it : a) cin >> it;
    vector<long long> hashArr[n + 1];
    for (long long i = 1; i <= n; i++) hashArr[i].push_back(0);
    for (long long i = 0; i < n; i++) hashArr[a[i]].push_back(i + 1);
    for (long long i = 1; i <= n; i++) hashArr[i].push_back(n + 1);
    long long info[n + 1];
    memset(info, -1, sizeof(info));
    for (long long i = 1; i <= n; i++) {
      long long maxDiff = 0;
      for (long long j = 1; j < hashArr[i].size(); j++)
        maxDiff = max(maxDiff, hashArr[i][j] - hashArr[i][j - 1]);
      if (info[maxDiff] == -1) info[maxDiff] = i;
    }
    long long currMin = LLONG_MAX;
    for (long long i = 1; i <= n; i++) {
      sum++;
      if (info[i] == -1) {
        if (currMin != LLONG_MAX) info[i] = currMin;
      } else {
        currMin = min(currMin, info[i]);
        info[i] = currMin;
      }
      cout << info[i] << " ";
    }
    cout << endl;
  }
  {
    __evars_begin(116);
    __evars(split("sum", ',').begin(), sum);
  };
  cerr << '\n'
       << "Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC
       << '\n';
}
