#include <bits/stdc++.h>
using namespace std;
int t;
int n;
int f[300011];
vector<int> pos[300011];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) pos[i].clear();
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      pos[x].push_back(i);
      f[i] = 1e9;
    }
    for (int i = 1; i <= n; i++) {
      int cur = 0;
      int Max = 0;
      if (pos[i].empty()) continue;
      for (auto x : pos[i]) {
        Max = max(Max, x - cur);
        cur = x;
      }
      Max = max(Max, n + 1 - cur);
      f[Max] = min(f[Max], i);
    }
    for (int i = 2; i <= n; i++) {
      f[i] = min(f[i], f[i - 1]);
    }
    for (int i = 1; i <= n; i++) {
      if (f[i] == 1e9) {
        cout << -1 << " ";
      } else {
        cout << f[i] << " ";
      }
    }
    cout << "\n";
  }
  return 0;
}
