#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<vector<int>> pos(n);
    for (int i = 0; i < n; ++i) {
      int x;
      cin >> x;
      --x;
      pos[x].emplace_back(i);
    }
    for (int i = 0; i < n; ++i) {
      pos[i].emplace_back(n);
    }
    vector<int> ans(n + 1, -1);
    for (int val = 0; val < n; ++val) {
      int curr = -1;
      int last = -1;
      for (int &x : pos[val]) {
        curr = max(curr, x - last);
        last = x;
      }
      for (int i = curr; i <= n && ans[i] == -1; ++i) {
        ans[i] = 1 + val;
      }
    }
    for (int i = 1; i <= n; ++i) {
      cout << ans[i] << ' ';
    }
    cout << '\n';
  }
}
