#include <bits/stdc++.h>
using namespace std;
void solve(vector<int> arr, int n) {
  vector<int> last(n + 1, -1);
  vector<int> mxd(n + 1, INT_MIN);
  vector<int> res(n + 1, 0);
  for (int i = 0; i < n; i++) {
    if (last[arr[i]] == -1) {
      last[arr[i]] = i;
      mxd[arr[i]] = i + 1;
    } else {
      mxd[arr[i]] = max(mxd[arr[i]], i - last[arr[i]]);
      last[arr[i]] = i;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (last[i] != -1) mxd[i] = max(mxd[i], n - last[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (mxd[i] != INT_MIN && res[mxd[i]] == 0) res[mxd[i]] = i;
  }
  for (int i = 1; i < n; i++) {
    if (res[i] == 0)
      res[i] = -1;
    else if (res[i + 1] > res[i] || res[i + 1] == 0)
      res[i + 1] = res[i];
  }
  for (int i = 1; i <= n; i++) {
    cout << res[i] << " ";
  }
  cout << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> arr(n);
    for (int i = 0; i < n; i++) cin >> arr[i];
    solve(arr, n);
  }
  return 0;
}
