#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include<math.h>
#include <string.h>
using namespace std;
typedef vector<int> vi ;
typedef long long ll;
#define all(x) (x).begin() , (x).end()
#define allR(x) (x).rbegin() , (x).rend()
#define pb push_back
const int N = 3e5+5, MX=2e9;
int a[N];
int main(){
// freopen("input.txt", "r", stdin);
int T;
cin >> T;
while ( T-- ){
int n;
scanf("%d", &n);
vector<pair<int,int>> v;
for(int i=0 ; i<n ; i++){
scanf("%d", a+i);
v.pb({a[i]+i+1, i+1});
}
sort(all(v));
for(int i=n-2 ; i>=0 ; i-- )
v[i].second = min( v[i].second , v[i+1].second );
for(int i=0 ; i<n ; i++ ){
int x = i+1-a[i];
auto it = lower_bound(v.begin(), v.end(), make_pair(x,-MX) );
if ( it == v.end() )
cout << -1 <<" ";
else
cout << it->second <<" ";
}
puts("");
}
}
Copy