/*
* Copyright (c) 2024 Emon Thakur
* All rights reserved.
*/
#include<bits/stdc++.h>
using namespace std;
//ofstream file("output19.txt");
void solve()
{
int n; cin>>n;
int a[n];
for(int i=0;i<n;i++) cin>>a[i];
int b[n]={0};
int ans=0;
for(int i=0;i<n;i++)
{
if(b[i]==0)
{
++ans;
int j=i;
while(j<n)
{
b[j]++;
if(b[j]>1) break;
j += a[j];
}
}
}
//file<<ans<<endl;
for(int i=0;i<n;i++)
{
if(i+a[i]<n && b[i+a[i]]==1) cout<<ans+1<<" ";
else cout<<ans<<" ";
}
cout<<endl;
//for(int i=0;i<n;i++) cout<<b[i]<<" "; cout<<endl<<endl;
}
int main()
{
ios::sync_with_stdio(false); cin.tie(nullptr);
//freopen("input19.txt","r",stdin);
int t; cin>>t; while(t--) solve();
}