#include <bits/stdc++.h>
using namespace std;
const int N = 300000 + 10;
int a[N], b[N], ans[N];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    unordered_map<int, vector<int>> ump;
    memset(ans, 0x3f, sizeof(int) * (n + 5));
    for (int i = 1; i <= n; i++) {
      scanf("%d", a + i);
      int x = a[i];
      if (!ump.count(x)) {
        ump[x].push_back(0);
        ump[x].push_back(n + 1);
      }
      ump[x].push_back(i);
    }
    for (auto it : ump) {
      sort(it.second.begin(), it.second.end());
      int d = 0;
      for (int i = 1; i < (int)it.second.size(); i++) {
        d = max(d, it.second[i] - it.second[i - 1]);
      }
      ans[d] = min(ans[d], it.first);
    }
    for (int i = 2; i <= n; i++) {
      ans[i] = min(ans[i], ans[i - 1]);
    }
    for (int i = 1; i <= n; i++) {
      printf("%d%c", ans[i] == ans[0] ? -1 : ans[i], " \n"[i == n]);
    }
  }
  return 0;
}
