// I AM A MUSLIM
#include "bits/stdc++.h"
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define fastIO std::ios::sync_with_stdio(0);std::cin.tie(0)
#define ll long long int
#define flush fflush(stdout)
#define bl printf("\n")
#define yn(a, b) printf("%s\n", a >= b ? "Yes":"No")
// #define int ll
using pii = std::pair<int,int>;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int mxN = 500005, inf = INT_MAX;
signed main() {
// fastIO;
int testCases=1;
scanf("%d",&testCases);
// std::cin>>testCases;
for (int TC = 1; TC <= testCases; TC++) {
int N;
scanf("%d",&N);
int par[N+1] = {0}, link[N+1], tot = 0;
memset(link, -1, sizeof link);
int a[N]; for (auto &i : a) scanf("%d",&i);
for (int i = 0; i < N; i++) {
int at = i+a[i];
if (at < N) link[i] = at;
if (par[i]) continue;
tot++;
while (at < N) {
par[at]++;
at += a[at];
}
}
// printf("%d\n", tot);
for (int i = 0; i < N; i++) {
int L = link[i];
// printf("(%d %d)\n", i, L);
int ans = tot;
if (L != -1 && par[L] == 1) ans++;
printf("%d ",ans);
} bl;
}
return 0;
}
/*
*/