#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int n, a[N], ans[N];
;
vector<int> b[N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) {
      b[i].clear();
      b[i].push_back(0);
      ans[i] = -1;
    }
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      b[a[i]].push_back(i);
    }
    for (int i = 1; i <= n; i++) {
      b[i].push_back(n + 1);
    }
    for (int i = 1; i <= n; i++) {
      if (b[i].size() == 0) {
        continue;
      }
      int mx = 0;
      for (int j = 1; j < b[i].size(); j++) {
        mx = max(mx, b[i][j] - b[i][j - 1]);
      }
      if (ans[mx] == -1) {
        ans[mx] = i;
      } else {
        ans[mx] = min(ans[mx], i);
      }
    }
    int temp = 1e9;
    for (int i = 1; i <= n; i++) {
      if (ans[i] != -1) {
        temp = min(temp, ans[i]);
      }
      if (temp == 1e9) {
        ans[i] = -1;
      } else {
        ans[i] = temp;
      }
    }
    for (int i = 1; i <= n; i++) {
      cout << ans[i] << " ";
    }
    cout << "\n";
  }
}
