#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
void Fast(){
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
}
void File() {
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.txt", "w", stdout);
#endif
}
typedef long long ll;
#define watch(x) cout << (#x) << " = " << x << '\n'
#define endl '\n'
#define all(a) a.begin(), a.end()
#define fix(n) cout << fixed << setprecision(n)
#define skip continue
const long double pi = acos(-1);
int dx[] = {2 , 2 , -2 , -2 , 1 , -1 , 1 , -1}; // , -1 , -1 , 1 , 1
int dy[] = {-1 , 1 , 1 , -1 , 2 , 2 , -2 , -2}; // , -1 , 1 , -1 , 1
int main(){
Fast();
int t;cin >> t;
while(t--){
int n;cin >> n;
vector<int>v(n);
for(int i = 0; i < n;i++){
cin >> v[i];
}
vector<pair<int,int>>v1(n);
vector<int>v2(n);
for(int i = 0; i < n;i++){
v1[i].first = (i+1) + v[i];
v1[i].second = i+1;
v2[i] = i - v[i];
}
sort(all(v1));
vector<int>res(n+1 , 1e9) , cur(n);
for(int i = n -1 ; i>= 0;i--){
res[i] = min(res[i+1] , v1[i].second);
cur[i] = v1[i].first;
}
vector<int>ans(n);
for(int i = 0 ; i < n;i++){
int idx = upper_bound(all(cur) , v2[i]) - cur.begin();
if(idx == n){
ans[i] = -1;
}
else{
ans[i] = res[idx];
}
}
for(int i = 0 ; i < n;i++){
cout << ans[i] << " \n"[i == n-1];
}
}
}
Copy