#include<bits/stdc++.h>
///#include "cmake-build-debug/Car.h"
using namespace std;
#define endl '\n'
#define ll long long
const int N = 2e5 + 5 ;
void fast() {
std::ios_base::sync_with_stdio(0);
cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("Input.txt", "r", stdin);
freopen("Output.txt", "w", stdout);
#endif
}
int main() {
fast() ;
int t ;
cin>>t ;
while (t--)
{
int n ;
cin>>n ;
vector<ll>a(n+5) ;
for (int i = 1 ; i <= n ; i++)
cin>>a[i] ;
ll mx = LLONG_MIN ;
vector<pair<ll,int>>mx_pair ;
for (int j=1 ;j<=n;j++)
{
ll cur = a[j] + j ;
if (cur > mx )
{
mx = cur ;
mx_pair.emplace_back(mx , j ) ;
}
}
sort(mx_pair.begin() , mx_pair.end()) ;
for (int i=1 ; i <= n ; i ++)
{
ll cur = i - a[i] ;
pair<ll,int> p = {cur , 0 } ;
int idx = lower_bound(mx_pair.begin() , mx_pair.end() , p ) - mx_pair.begin() ;
if (idx == (int)(mx_pair.size()))
{
cout << -1 << ' ' ;
}
else
{
cout << mx_pair[idx].second << ' ' ;
}
}
cout << endl ;
}
return 0 ;
}
Copy