#include <bits/stdc++.h>
using namespace std;
int t, n, k;
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    int a[n];
    vector<pair<int, int> > b(n + 7, {-1, 0});
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (b[a[i]].first == -1)
        b[a[i]] = {i, i + 1};
      else {
        int px = b[a[i]].first;
        int pp = b[a[i]].second;
        b[a[i]] = {i, max(i - px, pp)};
      }
    }
    for (int i = 1; i <= n; i++) {
      b[i].second = max(b[i].second, n - b[i].first);
    }
    vector<int> ans(n + 7, 1e7);
    for (int i = 1; i <= n; i++) {
      if (b[i].first != -1) {
        ans[b[i].second] = min(ans[b[i].second], i);
      }
    }
    for (int i = 1; i <= n; i++) {
      if (ans[i] == 1e7) ans[i] = -1;
    }
    int pxq = 1e7;
    for (int i = 1; i <= n; i++) {
      if (ans[i] != -1) {
        pxq = min(pxq, ans[i]);
      }
      if (pxq != 1e7) ans[i] = pxq;
    }
    for (int i = 1; i <= n; i++) cout << ans[i] << " ";
    cout << endl;
  }
}
