#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<vector<int> > ar(n + 1, vector<int>(0));
    int v;
    for (int i = 1; i <= n; i++) {
      cin >> v;
      ar[v].push_back(i);
    }
    vector<int> ans(n + 1, -1);
    for (int i = 1; i <= n; i++) {
      int mv = -1;
      for (int j = 0; j < ar[i].size(); j++) {
        if (j == 0) {
          mv = max(mv, ar[i][j] - 0);
        } else {
          mv = max(mv, ar[i][j] - ar[i][j - 1]);
        }
        if (j == ar[i].size() - 1) {
          mv = max(mv, (n + 1) - ar[i][j]);
        }
      }
      if (mv != -1 && ans[mv] == -1) {
        ans[mv] = i;
      }
    }
    for (int i = 2; i < ans.size(); i++) {
      if (ans[i] == -1) {
        ans[i] = ans[i - 1];
      }
    }
    for (int i = 2; i < ans.size(); i++) {
      if (ans[i] > ans[i - 1] && ans[i - 1] != -1) {
        ans[i] = ans[i - 1];
      }
    }
    for (int i = 1; i < ans.size(); i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
  }
}
