#include <bits/stdc++.h>
using namespace std;
int x, n, k, mid, t, arr[300005], ans[300005], last[300005];
signed main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) {
      arr[i] = 0;
      last[i] = 0;
      ans[i] = -1;
    }
    for (int i = 1; i <= n; i++) {
      cin >> x;
      arr[x] = max(arr[x], i - last[x]);
      last[x] = i;
    }
    for (int i = 1; i <= n; i++) {
      arr[i] = max(arr[i], n + 1 - last[i]);
      for (int j = arr[i]; j <= n && ans[j] == -1; j++) {
        ans[j] = i;
      }
    }
    for (int i = 1; i <= n; i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
  }
}
