The sequence $a$ is sent over the network as follows:

sequence $a$ is split into segments (each element of the sequence belongs to exactly one segment, each segment is a group of consecutive elements of sequence);

for each segment, its length is written next to it, either to the left of it or to the right of it;

the resulting sequence $b$ is sent over the network.

For example, we needed to send the sequence $a = [1, 2, 3, 1, 2, 3]$. Suppose it was split into segments as follows: $[{1}] + [\color{blue}{2, 3, 1}] + [\color{green}{2, 3}]$. Then we could have the following sequences:

$b = [1, {1}, 3, \color{blue}{2, 3, 1}, \color{green}{2, 3}, 2]$,

$b = [{1}, 1, 3, \color{blue}{2, 3, 1}, 2, \color{green}{2, 3}]$,

$b = [{1}, 1, \color{blue}{2, 3, 1}, 3, 2, \color{green}{2, 3}]$,

$b = [{1}, 1,\color{blue}{2, 3, 1}, 3, \color{green}{2, 3}, 2]$.

If a different segmentation had been used, the sent sequence might have been different.

The sequence $b$ is given. Could the sequence $b$ be sent over the network? In other words, is there such a sequence $a$ that converting $a$ to send it over the network could result in a sequence $b$?


-----Input-----

The first line of input data contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

Each test case consists of two lines.

The first line of the test case contains an integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the size of the sequence $b$.

The second line of test case contains $n$ integers $b_1, b_2, \dots, b_n$ ($1 \le b_i \le 10^9$) — the sequence $b$ itself.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.


-----Output-----

For each test case print on a separate line:

YES if sequence $b$ could be sent over the network, that is, if sequence $b$ could be obtained from some sequence $a$ to send $a$ over the network.

NO otherwise.

You can output YES and NO in any case (for example, strings yEs, yes, Yes and YES will be recognized as positive response).


-----Examples-----

Input
7
9
1 1 2 3 1 3 2 2 3
5
12 1 2 7 5
6
5 7 8 9 10 3
4
4 8 6 2
2
3 1
10
4 6 2 1 9 4 9 3 4 2
1
1
Output
YES
YES
YES
NO
YES
YES
NO


-----Note-----

In the first case, the sequence $b$ could be obtained from the sequence $a = [1, 2, 3, 1, 2, 3]$ with the following partition: $[{1}] + [\color{blue}{2, 3, 1}] + [\color{green}{2, 3}]$. The sequence $b$: $[{1}, 1, \color{blue}{2, 3, 1}, 3, 2, \color{green}{2, 3}]$.

In the second case, the sequence $b$ could be obtained from the sequence $a = [12, 7, 5]$ with the following partition: $[{12}] + [\color{green}{7, 5}]$. The sequence $b$: $[{12}, 1, 2, \color{green}{7, 5}]$.

In the third case, the sequence $b$ could be obtained from the sequence $a = [7, 8, 9, 10, 3]$ with the following partition: $[{7, 8, 9, 10, 3}]$. The sequence $b$: $[5, {7, 8, 9, 10, 3}]$.

In the fourth case, there is no sequence $a$ such that changing $a$ for transmission over the network could produce a sequence $b$.

Difficulty: MEDIUM_HARD

Solutions:
x = int(input())

def do(n, lis):
	dp = [True] + [False] * n
	for i in range(n):
		v = lis[i]
		if dp[i] and i + v < n:
			dp[i + v + 1] = True
		if i - v >= 0 and dp[i - v]:
			dp[i + 1] = True
	return dp[-1]
for _ in range(x):
	a = int(input())
	b = list(map(int, input().split()))
	print('YES' if do(a, b) else 'NO')


def ss(n, a):
	a = [0] + a
	dp = [False] * (n + 1)
	dp[0] = True
	for i in range(1, n + 1):
		if i + a[i] <= n and dp[i - 1] == True:
			dp[i + a[i]] = True
		if i - a[i] - 1 >= 0 and dp[i - a[i] - 1]:
			dp[i] = True
	if dp[-1] == True:
		return 'YES'
	return 'NO'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(ss(n, a))


def cal(n, b):
	if n == 1:
		return False
	t = [0] * n
	for i in range(n):
		if i == 0 or t[i - 1] == 1:
			if b[i] <= n - i - 1:
				t[i + b[i]] = 1
		if b[i] == i or (b[i] < i and t[i - b[i] - 1] == 1):
			t[i] = 1
		if t[-1] == 1:
			return True
	return False
for jj in range(int(input())):
	n = int(input())
	b = [int(i) for i in input().split()]
	if cal(n, b):
		print('YES')
	else:
		print('NO')


def foo(n, ls):
	flags = [False] * n
	for i in range(n):
		if i - ls[i] == 0:
			flags[i] = True
		elif i > ls[i] and flags[i - ls[i] - 1]:
			flags[i] = True
		if i + ls[i] < n and (i == 0 or flags[i - 1]):
			flags[i + ls[i]] = True
	return flags[-1]
t = int(input())
for _ in range(t):
	n = int(input())
	ls = [int(i) for i in input().split()]
	if foo(n, ls):
		print('YES')
	else:
		print('NO')


for n in (int(input()) for _ in range(int(input()))):
	(xs, dp) = (list(map(int, input().split())), [True] + [False] * n)
	for (i, x) in enumerate(xs):
		if i - x >= 0:
			dp[i + 1] |= dp[i - x]
		if i + x < n:
			dp[i + 1 + x] |= dp[i]
	print(['NO', 'YES'][dp[-1]])


t = int(input())
for _ in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	dp = [False] * (n + 1)
	dp[0] = True
	for i in range(0, n):
		if dp[i] and i + 1 + b[i] <= n:
			dp[i + 1 + b[i]] = True
		if i - b[i] >= 0 and dp[i - b[i]]:
			dp[i + 1] = True
	print('YES' if dp[n] else 'NO')


import sys
readline = sys.stdin.readline
T = int(readline())
for _ in range(T):
	N = int(readline())
	B = list(map(int, readline().split()))
	dp = [False] * (N + 1)
	dp[0] = True
	for i in range(1, N + 1):
		b = B[i - 1]
		if i + b <= N and dp[i - 1]:
			dp[i + b] = True
		if i - b - 1 >= 0 and dp[i - b - 1]:
			dp[i] = True
	print('YES' if dp[N] else 'NO')


def main():
	for t in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		dp = [0 for i in range(n + 1)]
		dp[0] = 1
		for i in range(n + 1):
			if i > 0 and i - a[i - 1] >= 1 and dp[i - a[i - 1] - 1]:
				dp[i] = 1
			if i < n and dp[i] and (i + a[i] + 1 <= n):
				dp[i + a[i] + 1] = 1
		print('YES' if dp[n] else 'NO')
main()


for nsfvfv in (int(input()) for _ in range(int(input()))):
	(xs, dp) = (list(map(int, input().split())), [True] + [False] * nsfvfv)
	for (i, xnsfvfv) in enumerate(xs):
		if i - xnsfvfv >= 0:
			dp[i + 1] |= dp[i - xnsfvfv]
		if i + xnsfvfv < nsfvfv:
			dp[i + 1 + xnsfvfv] |= dp[i]
	print(['NO', 'YES'][dp[-1]])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	dp = [0 for _ in range(n + 1)]
	dp[0] = 1
	for i in range(n):
		if dp[i] == 1 and i + l[i] + 1 <= n:
			dp[i + l[i] + 1] = 1
		if l[i] <= i and dp[i - l[i]] == 1:
			dp[i + 1] = 1
	if dp[-1] == 1:
		print('YES')
	else:
		print('NO')


from collections import defaultdict, deque, Counter
from functools import lru_cache, reduce
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
from random import randint
from fractions import Fraction as frac
import math
import operator
import sys
hpop = heappop
hpush = heappush
MOD = 10 ** 9 + 7

def solution():
	n = int(input())
	arr = list(map(int, input().split()))
	dp = [False] * len(arr)
	for i in range(n):
		if i == 0 or dp[i - 1]:
			end = i + arr[i]
			if end < len(dp):
				dp[end] = True
		start = i - arr[i] - 1
		if start == -1 or (start >= 0 and dp[start]):
			dp[i] = True
	print(['NO', 'YES'][dp[-1]])

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solution()
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	dp = [False] * (n + 1)
	dp[n] = True
	for i in range(n - 1, -1, -1):
		if i + arr[i] + 1 < n + 1:
			dp[i] = dp[i] or dp[i + arr[i] + 1]
		if dp[i + 1] and i - arr[i] >= 0:
			dp[i - arr[i]] = True
	if dp[0]:
		print('YES')
	else:
		print('NO')


import sys

def input():
	return sys.stdin.readline()[:-1]
t = int(input())
for _ in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	dp = ['NO'] * (n + 1)
	dp[0] = 'YES'
	for i in range(n):
		if i - b[i] >= 0 and dp[i - b[i]] == 'YES':
			dp[i + 1] = 'YES'
		if dp[i] == 'YES' and i + b[i] + 1 <= n:
			dp[i + b[i] + 1] = 'YES'
	print(dp[-1])


t = int(input())
for iter in range(t):
	n = int(input())
	line = input().split(' ')
	B = [int(x) for x in line]
	dp = [0 for i in range(n + 1)]
	dp[0] = 1
	for (j, x) in enumerate(B):
		i = j + 1
		if dp[i - 1] == 1 and i + x <= n:
			dp[i + x] = 1
		if i - x - 1 >= 0 and dp[i - x - 1] == 1:
			dp[i] = 1
	if dp[n] > 0:
		print('YES')
	else:
		print('NO')


tc = int(input())
for _ in range(tc):
	n = int(input())
	seq = [int(i) for i in input().split()]
	dp = [False for _ in range(n + 1)]
	dp[n] = True
	for i in range(n - 1, -1, -1):
		if i + seq[i] + 1 <= n:
			if dp[i + seq[i] + 1]:
				dp[i] = True
		if dp[i + 1]:
			next = i - seq[i]
			if next >= 0:
				dp[next] = True
	print('YES' if dp[0] else 'NO')


import sys
input = sys.stdin.readline
maxn = 200000.0 + 10

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print('NO')
		return
	dp = [0 for i in range(n + 1)]
	dp[0] = 1
	for i in range(n + 1):
		if i and i - 1 - a[i - 1] >= 0:
			dp[i] |= dp[i - 1 - a[i - 1]]
		if i < n and i + a[i] + 1 <= n:
			dp[i + a[i] + 1] |= dp[i]
	if dp[n]:
		print('YES')
	else:
		print('NO')
for T in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	flags = [False] * n
	for i in range(n):
		if i - l[i] == 0:
			flags[i] = True
		elif i > l[i] and flags[i - l[i] - 1]:
			flags[i] = True
		if i + l[i] < n and (i == 0 or flags[i - 1]):
			flags[i + l[i]] = True
	if flags[-1]:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [0] + [int(x) for x in input().split()]
	dp = [0] * (n + 1)
	dp[0] = 1
	for i in range(1, n + 1):
		if dp[i - 1] and i + a[i] <= n:
			dp[i + a[i]] = 1
		if i - a[i] - 1 >= 0 and dp[i - a[i] - 1]:
			dp[i] = 1
	if dp[n]:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
while t > 0:
	n = int(input())
	b = list(map(int, input().split()))
	b.insert(0, -1)
	dp = [False for i in range(n + 1)]
	dp[0] = True
	for i in range(1, n + 1):
		if i + b[i] <= n and dp[i - 1]:
			dp[i + b[i]] = True
		if i - b[i] - 1 >= 0:
			if dp[i - b[i] - 1]:
				dp[i] = True
	if dp[n]:
		print('YES')
	else:
		print('NO')
	t -= 1


from functools import lru_cache as cache
from collections import Counter, defaultdict, deque
import math
import bisect
import string
from heapq import *
import sys

def get_int():
	return int(input())

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_str():
	return sys.stdin.readline().strip()

def main():
	testcases = get_int()
	for _ in range(testcases):
		n = get_int()
		b = get_list()
		print(solve(n, b))

def solve(n, b):
	dp = [0 for i in range(n)]
	for i in range(n):
		if (i == 0 or dp[i - 1] == True) and i + b[i] < n:
			dp[i + b[i]] = 1
		if i - b[i] - 1 == -1 or (i - b[i] - 1 >= 0 and dp[i - b[i] - 1]):
			dp[i] = 1
	if dp[-1]:
		return 'YES'
	return 'NO'
main()


for jj in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	t = [0] * n
	for i in range(n):
		if i == 0 or t[i - 1] == 1:
			if arr[i] <= n - i - 1:
				t[i + arr[i]] = 1
		if arr[i] == i or (arr[i] < i and t[i - arr[i] - 1] == 1):
			t[i] = 1
		if t[-1] == 1:
			break
	if t[-1]:
		print('YES')
	else:
		print('NO')


tc = int(input())
for i in range(0, tc):
	l = int(input())
	sequence = [int(part) for part in input().split()]
	can_sequence_start = [0 for _ in range(l + 1)]
	can_sequence_start[0] = 1
	for i in range(0, len(sequence)):
		if can_sequence_start[i] == 1:
			if sequence[i] + i + 1 < len(can_sequence_start):
				can_sequence_start[sequence[i] + i + 1] = 1
		if i - sequence[i] >= 0:
			if can_sequence_start[i - sequence[i]] == 1:
				can_sequence_start[i + 1] = 1
	if can_sequence_start[len(can_sequence_start) - 1] == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for o in range(t):
	n = int(input())
	arr = tuple(map(int, input().split()))
	dp = [False for i in range(0, n + 1)]
	dp[0] = True
	for i in range(0, n + 1):
		if i - arr[i - 1] - 1 >= 0 and dp[i - arr[i - 1] - 1]:
			dp[i] = True
		if i < n and dp[i]:
			if i + 1 + arr[i] <= n:
				dp[i + 1 + arr[i]] = True
	if dp[n]:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	a = int(input())
	b = list(map(int, input().split()))
	f = [0 for _ in range(a + 1)]
	f[0] = 1
	b.insert(0, 0)
	b.append(0)
	for i in range(a + 1):
		if i - b[i] - 1 >= 0 and f[i - b[i] - 1]:
			f[i] = 1
		if f[i] and i + b[i + 1] + 1 <= a:
			f[i + b[i + 1] + 1] = 1
	if f[a]:
		print('YES')
	else:
		print('NO')


test = int(input())
while test > 0:
	n = int(input())
	b = list(map(int, input().split()))
	dp = []
	for i in range(n + 1):
		dp.append(False)
	dp[0] = True
	if n >= b[0] + 1:
		dp[b[0] + 1] = True
	for i in range(n):
		if b[i] <= i and dp[i + 1] == False:
			dp[i + 1] = dp[i - b[i]]
		if dp[i + 1] and i < n - 1:
			if n - i - 1 >= b[i + 1] + 1:
				dp[i + b[i + 1] + 2] = True
	if dp[n]:
		print('YES')
	else:
		print('NO')
	test -= 1


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	possible = [False for i in range(n + 1)]
	possible[0] = True
	for i in range(n):
		if possible[i]:
			l_L = a[i] + 1
			l_ext = i + l_L
			if l_ext <= n:
				possible[l_ext] = True
		l_R = a[i] + 1
		rem = i + 1 - l_R
		if rem >= 0 and possible[rem]:
			possible[i + 1] = True
	if possible[n]:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	b = [int(x) for x in input().split()]
	dp = [False] * n
	for i in range(n):
		if not dp[i] and b[i] == i:
			dp[i] = True
		if (i > 0 and dp[i - 1] or i == 0) and i + b[i] < n:
			dp[i + b[i]] = True
		if i > b[i] - 1:
			if dp[i - b[i] - 1]:
				dp[i] = True
	if dp[n - 1]:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	nums = [int(i) for i in input().split()]
	dp = [False] * len(nums)
	for (i, v) in enumerate(nums):
		if not 0 < v < len(nums):
			continue
		if i + v < len(nums) and (i - 1 < 0 or dp[i - 1]):
			dp[i + v] = True
		if i - v >= 0 and (i - v == 0 or dp[i - v - 1]):
			dp[i] = True
	print('YES' if dp[-1] else 'NO')


for _ in ' ' * int(input()):
	n = int(input())
	(*a,) = map(int, input().split())
	dp = [False] * n
	dp = [True] + dp
	for i in range(1, n + 1):
		if dp[i - 1] and i + a[i - 1] <= n:
			dp[i + a[i - 1]] = True
		if i - a[i - 1] - 1 >= 0:
			dp[i] |= dp[i - a[i - 1] - 1]
	if dp[-1]:
		print('YES')
	else:
		print('NO')


import sys
import math
from bisect import bisect_right as br
from collections import deque
from itertools import combinations as cb

def int_arr():
	return list(map(int, sys.stdin.readline().strip().split()))

def str_arr():
	return list(map(str, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	arr = int_arr()
	ch = [0 for i in range(n)]
	for i in range(n):
		if i - arr[i] >= 0:
			if i - arr[i] - 1 == -1:
				ch[i] = 1
			elif ch[i - arr[i] - 1] == 1:
				ch[i] = 1
		if i + arr[i] < n:
			if i - 1 == -1:
				ch[i + arr[i]] = 1
			elif ch[i - 1] == 1:
				ch[i + arr[i]] = 1
	if ch[-1] == 1:
		print('YES')
	else:
		print('NO')


import math

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	dp = [False] * (n + 11)
	Q = [[] for i in range(n + 11)]
	for i in range(1, n + 1):
		l = i
		r = a[i - 1] + i
		if r <= n:
			Q[l].append(r)
		l = i - a[i - 1]
		r = i
		if l >= 1:
			Q[l].append(r)
	dp[1] = True
	for i in range(1, n + 1):
		if not dp[i]:
			continue
		for j in Q[i]:
			dp[j + 1] = True
	print('YES' if dp[n + 1] else 'NO')
T = int(input())
for i in range(T):
	solve()


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	b = list(map(int, input().split()))
	dp = [False] * (n + 1)
	dp[0] = True
	st = set()
	for i in range(1, n + 1):
		if dp[i - 1]:
			st.add(b[i - 1] + (i - 1))
		if i - b[i - 1] - 1 >= 0:
			dp[i] = dp[i - b[i - 1] - 1]
		if i - 1 in st:
			dp[i] = True
	if dp[-1]:
		print('YES')
	else:
		print('NO')


def mi():
	return map(int, input().split())

def li():
	return list(mi())

def si():
	return str(input())

def ni():
	return int(input())
from math import inf
import sys
sys.setrecursionlimit(1000000)
for _ in range(int(input())):
	n = ni()
	b = li()
	ans = [False] * (n + 1)
	ans[0] = True
	for i in range(1, n + 1):
		if b[i - 1] < i and i - b[i - 1] - 1 >= 0 and (ans[i - b[i - 1] - 1] == True):
			ans[i] = True
		if i > 0 and ans[i - 1] == True and (i + b[i - 1] <= n):
			ans[i + b[i - 1]] = True
	if ans[-1] == True:
		print('YES')
	else:
		print('NO')


t = int(input())
for p in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	dp = [[False, False, False] for k in range(n + 1)]
	dp[0][2] = True
	x = a[0]
	if x + 1 <= n:
		dp[x + 1][2] = True
	for i in range(1, n):
		x = a[i]
		if dp[i][2] and i + x + 1 <= n:
			dp[i + x + 1][2] = True
		if i - x >= 0 and dp[i - x][2]:
			dp[i][1] = True
			if i + 1 <= n:
				dp[i + 1][2] = True
	if dp[n][2]:
		print('YES')
	else:
		print('NO')


def __(f):
	for i in range(len(f)):
		print(f[i][0], end=' ')
	print()
	for i in range(len(f)):
		print(f[i][1], end=' ')
	print()
for _ in range(int(input())):
	n = int(input())
	arr = [0] + list(map(int, input().split()))
	f = [[True, True]] + [[False, False] for i in range(len(arr))]
	for (i, a) in enumerate(arr):
		if i > 0:
			pre_idx = i - a - 1
			if pre_idx >= 0 and (f[pre_idx][0] or f[pre_idx][1]):
				f[i][0] = True
			else:
				f[i][0] = False
			if (f[i - 1][0] or f[i - 1][1]) and i + a < len(arr):
				f[i + a][1] = True
	if f[len(arr) - 1][0] or f[len(arr) - 1][1]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	dp = [0] * (n + 1)
	dp[0] = 1
	for i in range(n):
		if a[i] < i + 1:
			dp[i + 1] = max(dp[i - a[i]], dp[i + 1])
		if a[i] + i + 1 <= n:
			dp[i + 1 + a[i]] = max(dp[i], dp[i + 1 + a[i]])
	if dp[-1] == 1:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	num = int(input())
	x = input()
	dp = [0 for i in range(num + 1)]
	Se = [int(n1) for n1 in x.split()]
	dp[0] = 1
	for j in range(num):
		if j - Se[j] >= 0:
			dp[j + 1] = max(dp[j - Se[j]], dp[j + 1])
		if j + Se[j] < num:
			dp[j + 1 + Se[j]] = max(dp[j], dp[j + 1 + Se[j]])
	if dp[num] == 1:
		print('YES')
	else:
		print('NO')


def solve():
	n = int(input())
	b = input().split(' ')
	b = [int(x) for x in b]
	dp = [False for _ in range(n + 1)]
	dp[-1] = True
	h = {}
	for j in range(n):
		if j not in h:
			h[j] = []
		if j - b[j] >= 0:
			h[j - b[j]].append(j)
	for i in range(n - 1, -1, -1):
		x = b[i]
		if x <= n - (i + 1):
			dp[i] = dp[i] or dp[i + x + 1]
		for j in h[i]:
			dp[i] = dp[i] or dp[j + 1]
	if dp[0]:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	b = list(map(int, input().split()))
	moves = [[] for i in range(n)]
	for i in range(n):
		if i + b[i] <= n - 1:
			moves[i].append(i + b[i] + 1)
		if i - b[i] >= 0:
			moves[i - b[i]].append(i + 1)
	visit = [False for i in range(n + 1)]
	visit[0] = True
	for i in range(n):
		if not visit[i]:
			continue
		for j in moves[i]:
			visit[j] = True
	print(['NO', 'YES'][visit[-1]])


from sys import stdin, stdout
N = 200002
g = [[] for i in range(N)]
vis = None

def dfs(source):
	st = [source]
	while st:
		u = st.pop()
		if not vis[u]:
			vis[u] = True
			for v in g[u]:
				st.append(v)
tc = int(stdin.readline())
output = ''
for cs in range(tc):
	n = int(stdin.readline())
	a = [int(x) for x in stdin.readline().split()]
	for i in range(n):
		if i + a[i] < n:
			g[i].append(i + a[i] + 1)
		if i - a[i] >= 0:
			g[i - a[i]].append(i + 1)
	vis = [False for i in range(n + 1)]
	dfs(0)
	if vis[n]:
		output += 'YES\n'
	else:
		output += 'NO\n'
	for i in range(n):
		g[i].clear()
print(output)


t = int(input())
for _ in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	graph = [set() for i in range(n)]
	for (i, b_i) in enumerate(b):
		if i - b_i >= 0:
			graph[i - b_i].add(i + 1)
		if i + b_i <= n - 1:
			graph[i].add(i + b_i + 1)
	good = [0 for i in range(n + 1)]
	good[0] = 1
	for i in range(n):
		if good[i]:
			for j in graph[i]:
				good[j] = 1
	print('YES' if good[n] else 'NO')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	bs = list(map(int, input().split()))
	lookup = defaultdict(set)
	for i in range(n):
		head = i - bs[i]
		if 0 <= head < n:
			lookup[head].add(i)
	for i in range(n):
		tail = i + bs[i]
		if 0 <= tail < n:
			lookup[i].add(tail)
	dp = [False] * n
	for i in range(n):
		if i == 0:
			for j in lookup[i]:
				dp[j] = True
			continue
		if not dp[i - 1]:
			continue
		for j in lookup[i]:
			dp[j] = True
	if dp[n - 1]:
		print('YES')
	else:
		print('NO')