#include <bits/stdc++.h>
using namespace std;
long long arr[300005];
long long ans[300005];
int N;
bool test(int n, int k) {
  for (int i = n; i < N; i += k) {
    if (arr[i] != arr[n]) return false;
  }
  return true;
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    cin >> N;
    unordered_map<int, vector<int>> um;
    set<int> s;
    for (int i = 0; i < N; ++i) {
      int cur;
      cin >> cur;
      ans[i + 1] = 300005;
      um[cur].push_back(i);
      s.insert(cur);
    }
    int curM = N;
    for (auto itr = s.begin(); itr != s.end(); ++itr) {
      vector<int>& e = um[*itr];
      int MAX = e[0] + 1;
      for (int i = 1; i < e.size(); ++i) {
        MAX = max(MAX, e[i] - e[i - 1]);
      }
      MAX = max(MAX, N - e[e.size() - 1]);
      for (int i = MAX; i <= curM; ++i) {
        ans[i] = min(ans[i], 1ll * (*itr));
      }
      curM = min(curM, MAX - 1);
    }
    for (int i = 1; i <= N; ++i) {
      if (ans[i] == 300005) {
        cout << "-1 ";
      } else {
        cout << ans[i] << ' ';
      }
    }
    cout << endl;
  }
}
