#include <bits/stdc++.h>
using namespace std;
int a[400000];
int pos[400000];
pair<int, int> gap[400000];
int ans[400000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tests = 1;
  cin >> tests;
  while (tests--) {
    int n;
    cin >> n;
    for (int i = 0; i < n + 2; i++) {
      pos[i] = -1;
      gap[i].first = -1;
      gap[i].second = i;
    }
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
      gap[a[i]].first = max(gap[a[i]].first, i - pos[a[i]] - 1);
      pos[a[i]] = i;
    }
    for (int i = 0; i < n; i++) {
      gap[a[i]].first = max(gap[a[i]].first, n - pos[a[i]] - 1);
    }
    sort(gap + 1, gap + n + 1);
    int k = 1;
    while (gap[k].first == -1) {
      k++;
    }
    for (int i = 0; i < n; i++) {
      ans[i] = -1;
    }
    int mi = gap[k].second;
    for (int i = k; i < n + 1; i++) {
      if (gap[i].second >= mi) {
        gap[i].second = mi;
      } else {
        mi = gap[i].second;
      }
    }
    for (int i = k; i < n + 1; i++) {
      ans[gap[i].first] = gap[i].second;
    }
    for (int i = 1; i < n; i++) {
      if (ans[i] == -1) {
        ans[i] = ans[i - 1];
      }
    }
    for (int i = 0; i < n; i++) {
      cout << ans[i] << " ";
    }
    cout << "\n";
  }
}
