#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n + 1];
    map<int, int> ma;
    map<int, int> ans;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      ans[a[i]] = max(ans[a[i]], i - ma[a[i]]);
      ma[a[i]] = i;
    }
    for (map<int, int>::iterator it = ma.begin(); it != ma.end(); it++) {
      ans[it->first] = max(ans[it->first], (n + 1) - (it->second));
    }
    int answer[n + 1];
    for (int i = 1; i <= n; i++) {
      answer[i] = -1;
    }
    for (map<int, int>::iterator it = ans.begin(); it != ans.end(); it++) {
      if (answer[it->second] == -1) {
        answer[it->second] = it->first;
      } else {
        answer[it->second] = min(answer[it->second], it->first);
      }
    }
    int mini = -1;
    for (int i = 1; i <= n; i++) {
      if (answer[i] != -1) {
        if (mini == -1) {
          mini = answer[i];
        } else {
          mini = min(answer[i], mini);
        }
      }
      answer[i] = mini;
      cout << answer[i] << ' ';
    }
    cout << endl;
  }
}
