#include <bits/stdc++.h>
using namespace std;
signed main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<vector<int> > ind(n + 1);
    for (int i = 0; i < n + 1; i++) {
      ind[i].push_back(-1);
    }
    int x;
    for (int i = 0; i < n; i++) {
      cin >> x;
      ind[x].push_back(i);
    }
    for (int i = 0; i < n + 1; i++) {
      if (ind[i].size() == 1) {
        ind[i].pop_back();
      } else {
        ind[i].push_back(n);
      }
    }
    int ans[n + 1];
    for (int i = 0; i <= n; i++) {
      ans[i] = INT_MAX;
    }
    for (int i = 1; i <= n; i++) {
      int temp = 0;
      for (int j = 1; j < ind[i].size(); j++) {
        temp = max(ind[i][j] - ind[i][j - 1], temp);
      }
      if (temp != 0) {
        ans[temp] = min(ans[temp], i);
      }
    }
    for (int i = 1; i <= n; i++) {
      ans[i] = min(ans[i], ans[i - 1]);
    }
    for (int i = 1; i <= n; i++) {
      if (ans[i] == INT_MAX) {
        cout << -1 << ' ';
      } else {
        cout << ans[i] << ' ';
      }
    }
    cout << endl;
  }
}
