#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> arr(n + 1);
  vector<int> store(n + 1, INT_MAX);
  vector<int> last(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    if (store[arr[i]] == INT_MAX) {
      store[arr[i]] = i - last[arr[i]] - 1;
    } else
      store[arr[i]] = max(store[arr[i]], i - last[arr[i]] - 1);
    last[arr[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    store[i] = max(store[i], n - last[i]);
  }
  map<int, vector<int>> mp;
  for (int i = 1; i <= n; i++) {
    mp[store[i]].push_back(i);
  }
  for (auto &item : mp) {
    sort(item.second.begin(), item.second.end());
  }
  vector<int> solution(n + 1);
  int ans = INT_MAX;
  for (int i = 1; i <= n; i++) {
    if (mp.find(i - 1) != mp.end()) {
      ans = min(ans, mp[i - 1][0]);
    }
    if (ans == INT_MAX) {
      solution[i] = -1;
    } else {
      solution[i] = ans;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << solution[i] << " ";
  }
  cout << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
