#include <bits/stdc++.h>
using namespace std;
const int OO = 0x3f3f3f3f, NegOO = -1 * OO, N = 3e5 + 5, mod = 1 << 31;
vector<int> pos[N];
vector<int> allNums;
int ansPos[N];
int n;
bool tmam(int num, int sz) {
  int pre = -1;
  for (auto u : pos[num]) {
    if (u - pre > sz) {
      return 0;
    }
    pre = u;
  }
  if (n - pre > sz) return 0;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0), ios::sync_with_stdio(0), cin.tie(0),
      cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    int arr[n];
    allNums.clear();
    memset(ansPos, OO, (n + 1) * sizeof(ansPos[0]));
    for (int i = 0; i < n; ++i) {
      cin >> arr[i];
      allNums.push_back(arr[i]);
    }
    sort(allNums.begin(), allNums.end());
    allNums.erase(unique(allNums.begin(), allNums.end()), allNums.end());
    for (int i = 0; i < allNums.size(); ++i) pos[allNums[i]].clear();
    for (int i = 0; i < n; ++i) pos[arr[i]].push_back(i);
    for (auto num : allNums) {
      int mxy = 0, pre = -1;
      for (auto j : pos[num]) {
        mxy = max(mxy, j - pre);
        pre = j;
      }
      mxy = max(mxy, n - pre);
      if (ansPos[mxy] == OO) ansPos[mxy] = num;
    }
    for (int i = 1; i <= n; ++i) {
      ansPos[i] = min(ansPos[i - 1], ansPos[i]);
      cout << (ansPos[i] <= n ? ansPos[i] : -1) << " ";
    }
    cout << "\n";
  }
  return 0;
}
