#include <bits/stdc++.h>
#define ll long long
#define mk make_pair
#define pb push_back
#define f first
#define s second
using namespace std;
ll mod = 1e9 + 7 ;
const int N = 1e6 + 10 ;
void solve(){
int n ;
cin >> n ;
vector<int> a(n + 1) ;
vector<pair<int,int>> v ;
int lst = -2e9;
for(int i=1 ; i<=n ; i++){
scanf("%d" , &a[i]) ;
if(a[i] + i > lst){
v.pb({a[i] + i , i}) ;
lst = a[i] + i ;
}
}
for(int i=1 ; i<=n ; i++){
int idx = lower_bound(v.begin() , v.end() , mk(i - a[i] , -1) ) - v.begin() ;
cout << (idx == v.size() ? -1 : v[idx].s) << " " ;
}
cout << endl;
}
int main(){
int t = 1 ;
cin >> t ;
while(t--){
solve();
}
return 0 ;
}
Copy