#include <bits/stdc++.h>
using namespace std;
vector<int> adj[(int)3e5 + 1];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i <= n; i++) {
      adj[i].clear();
      adj[i].push_back(0);
    }
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      adj[x].push_back(i);
    }
    for (int i = 0; i <= n; i++) {
      adj[i].push_back(n + 1);
    }
    int val = -1, mn = 1e9;
    vector<int> ans(n + 1, -1);
    for (int i = 1; i <= n; i++) {
      int index = 0;
      if (adj[i].size() == 2) {
        continue;
      }
      for (int j = 1; j < adj[i].size(); j++) {
        index = max(index, adj[i][j] - adj[i][j - 1]);
      }
      if (ans[index] == -1) {
        ans[index] = i;
      }
    }
    bool flag = false;
    for (int i = 1; i <= n; i++) {
      if (flag == false) {
        if (ans[i] != -1) {
          val = ans[i];
          flag = true;
        }
      } else {
        if (ans[i] == -1) {
          ans[i] = val;
        } else if (ans[i] > val) {
          ans[i] = val;
        } else {
          val = ans[i];
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      cout << ans[i] << " ";
    }
    cout << "\n";
  }
}
