#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, i, j;
    cin >> n;
    int arr[n + 1];
    vector<int> ans(n + 10, 0), tmp(n + 10, 0);
    for (i = 1; i <= n; i++) cin >> arr[i];
    for (i = 1; i <= n; i++) {
      ans[arr[i]] = max(ans[arr[i]], i - tmp[arr[i]]);
      tmp[arr[i]] = i;
    }
    vector<int> anss(n + 15, n + 5);
    for (i = 1; i <= n; i++) {
      ans[i] = max(ans[i], n + 1 - tmp[i]);
    }
    for (i = 1; i <= n; i++) {
      anss[ans[i]] = min(i, anss[ans[i]]);
    }
    for (i = 1; i <= n; i++) {
      anss[i] = min(anss[i], anss[i - 1]);
      if (anss[i] > n)
        cout << "-1 ";
      else
        cout << anss[i] << " ";
    }
    printf("\n");
  }
  return 0;
}
