#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    map<int, vector<int>> idx;
    for (int i = 0, x; i < n; i++) {
      cin >> x;
      idx[x].push_back(i + 1);
    }
    vector<int> ans(n + 1, -1);
    for (auto i : idx) {
      int cur = 0;
      for (int j = 1; j < i.second.size(); j++)
        cur = max(cur, i.second[j] - i.second[j - 1]);
      cur = max({cur, i.second[0], (n + 1) - i.second.back()});
      if (ans[cur] == -1)
        ans[cur] = i.first;
      else
        ans[cur] = min(ans[cur], i.first);
    }
    for (int i = 1, cur = -1; i <= n; i++) {
      if (cur == -1)
        cur = ans[i];
      else if (ans[i] != -1)
        cur = min(cur, ans[i]);
      cout << cur << ' ';
    }
    cout << endl;
  }
  return 0;
}
