#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &i : a) cin >> i;
    map<int, vector<int>> pos;
    for (int i = 0; i < n; i++) pos[a[i]].push_back(i);
    vector<int> ans(n + 1, INT_MAX);
    for (int i = 1; i <= n; i++) {
      if (pos[i].empty()) continue;
      int mx = INT_MIN;
      for (int j = 1; j < pos[i].size(); ++j) {
        mx = max(mx, pos[i][j] - pos[i][j - 1]);
      }
      mx = max(mx, n - pos[i].back());
      mx = max(mx, pos[i][0] + 1);
      ans[mx] = min(ans[mx], i);
    }
    ans[n] = *min_element(a.begin(), a.end());
    int c = INT_MAX;
    vector<int> out(n + 1);
    for (int i = 1; i <= n; i++) {
      c = min(c, ans[i]);
      out[i] = c;
    }
    for (int i = 1; i <= n; i++) {
      if (out[i] == INT_MAX)
        cout << -1;
      else
        cout << out[i];
      cout << ' ';
    }
    cout << '\n';
  }
}
