#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    int n;
    cin >> n;
    vector<int> v[n + 1];
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      v[x].push_back(i);
    }
    vector<int> d[n + 1];
    for (int i = 1; i <= n; i++) {
      if (v[i].empty()) continue;
      int mx = max(v[i][0], n + 1 - v[i].back());
      for (int j = 1; j < (int)v[i].size(); j++) {
        mx = max(mx, v[i][j] - v[i][j - 1]);
      }
      d[mx].push_back(i);
    }
    int ans = 1000000007;
    for (int i = 1; i <= n; i++) {
      for (auto g : d[i]) ans = min(ans, g);
      if (ans == 1000000007)
        cout << -1;
      else
        cout << ans;
      cout << " ";
    }
    cout << "\n";
  }
}
