Let's call a sequence good if the sum of all its elements is $0$.
You have a sequence of integers $A_1, A_2, \ldots, A_N$. You may perform any number of operations on this sequence (including zero). In one operation, you should choose a valid index $i$ and decrease $A_i$ by $i$. Can you make the sequence good using these operations?

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- The second line contains $N$ space-separated integers $A_1, A_2, \ldots, A_N$.

-----Output-----
For each test case, print a single line containing the string "YES" if it is possible to make the given sequence good or "NO" if it is impossible.

-----Constraints-----
- $1 \le T \le 1,000$
- $1 \le N \le 10$
- $|A_i| \le 100$ for each valid $i$

-----Subtasks-----
Subtask #1 (10 points): $N = 1$
Subtask #2 (30 points): $N \le 2$
Subtask #3 (60 points): original constraints

-----Example Input-----
2
1
-1
2
1 2

-----Example Output-----
NO
YES

-----Explanation-----
Example case 2: We can perform two operations ― subtract $1$ from $A_1$ and $2$ from $A_2$.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
for M in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	if sum(a) >= 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	t = int(input())
	m = list(map(int, input().split()))
	(p, q) = (0, 0)
	if t == 1:
		if m[0] >= 0:
			print('YES')
		else:
			print('NO')
	else:
		for i in m:
			if i < 0:
				q += 1
			else:
				p += 1
		if p >= abs(q):
			print('YES')
		else:
			print('NO')


T = int(input())
for i in range(0, T):
	n = int(input())
	arr = list(map(int, input().split()))
	flag = 0
	if sum(arr) < 0:
		flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(int(input()))
	inp = list(map(int, input().split()))
	if sum(inp) >= 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for tj in range(T):
	N = int(input())
	array_n = list(map(int, input().split()))
	sum_array = sum(array_n)
	if sum_array >= 0:
		print('YES')
	else:
		print('NO')


for T in range(int(input())):
	(n, l) = (int(input()), list(map(int, input().split())))
	print('YES') if sum(l) >= 0 else print('NO')


for t in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	print('YES') if sum(lst) >= 0 else print('NO')


for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	k = sum(b)
	if k >= 0:
		print('YES')
	else:
		print('NO')


n = int(input())
testCases = []
nTc = []
resCase = []
for i in range(n):
	nTc.append(int(input()))
	if sum(list(map(int, input().split()))) >= 0:
		print('YES')
	else:
		print('NO')


t = input()
for c in range(0, int(t)):
	n = int(input())
	l = list(map(int, input().split()))
	a = sum(l)
	if a >= 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if sum(arr) > 0 or sum(arr) == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	for j in range(n):
		s = s + l[j]
	l.sort(reverse=True)
	if s >= 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	if s >= 0:
		print('YES')
	else:
		print('NO')
	t = t - 1


T = int(input())
for i in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	if s < 0:
		print('NO')
	elif s >= 0:
		print('YES')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	s = sum(arr)
	if s >= 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = input()
	if sum([int(x) for x in input().split()]) < 0:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	n = input()
	x = list(map(int, input().split()))
	if sum(x) >= 0:
		print('YES')
	else:
		print('NO')


import sys
from math import sqrt, gcd
from collections import deque, Counter, OrderedDict
I = lambda : int(input())
S = lambda : input().strip()
M = lambda : map(int, input().strip().split())
L = lambda : list(map(int, input().strip().split()))
mod = 1000000007
for _ in range(I()):
	n = I()
	a = L()
	print('YES' if sum(a) >= 0 else 'NO')


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	s1 = sum(s)
	if s1 < 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for x in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	for i in l:
		if i < 0:
			print('NO')
			break
	else:
		print('YES')


for _ in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	print('YES' if sum(L) >= 0 else 'NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(pos, ne) = (0, 0)
	for i in l:
		if i >= 0:
			pos = pos + i
		else:
			ne = ne + abs(i)
	if pos >= ne:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	o = int(input())
	op = list(map(int, input().split()))
	if sum(op) >= 0:
		print('YES')
	else:
		print('NO')


for test in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	if sum(l) >= 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	n = int(input())
	L = list(map(int, input().split()))
	m = sum(L)
	if m >= 0:
		print('YES')
	else:
		print('NO')


def fun(s):
	if sum(s) >= 0:
		return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().strip().split()))[:n]
	print(fun(lst))


for a in range(int(input())):
	N = int(input())
	l = list(map(int, input().split()))
	if sum(l) >= 0:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if sum(arr) >= 0:
		print('YES')
	elif sum(arr) < 0:
		print('NO')


t = int(input())
while t:
	flag = False
	item = int(input())
	arr = list(map(int, input().split()))
	print('YES' if sum(arr) >= 0 else 'NO')
	t -= 1


for __ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(p_c, n_c) = (0, 0)
	if n == 1:
		if arr[0] >= 0:
			print('YES')
		else:
			print('NO')
	else:
		for i in arr:
			if i < 0:
				n_c += i
			else:
				p_c += i
		if p_c >= abs(n_c):
			print('YES')
		else:
			print('NO')


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(a, b) = (0, 0)
	if n == 1:
		if l[0] >= 0:
			print('YES')
		else:
			print('NO')
	else:
		for i in l:
			if i < 0:
				b += i
			else:
				a += i
		if a >= abs(b):
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	g = int(input())
	ar = list(map(int, input().lstrip().split()))
	h = sum(ar)
	if h >= 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	if sum(l) >= 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	s = sum(a)
	while True:
		if s == 0:
			print('YES')
			break
		elif s < 0:
			print('NO')
			break
		elif s >= n:
			a[n - 1] -= n
		else:
			a[s - 1] -= s
		s = sum(a)


t = int(input())
for test in range(t):
	n = int(input())
	arr = [int(char) for char in input().split()]
	sum1 = sum(arr)
	if sum1 < 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if sum(a) >= 0:
		print('YES')
	elif sum(a) < 0:
		print('NO')


n = int(input())
for i in range(n):
	a = int(input())
	l = [int(x) for x in input().split()]
	if sum(l) >= 0:
		print('YES')
	else:
		print('NO')


t = int(input(''))
for i in range(1, t + 1):
	n = int(input(''))
	A = list(map(int, input().split()))
	if sum(A) < 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().lstrip().split()))
	s = sum(arr)
	if s >= 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	search = 0
	for i in range(len(a)):
		if a[i] < 0:
			search = 1
			break
	if search == 1:
		print('NO')
	else:
		print('YES')


def solve():
	n = int(input())
	a = list(map(int, input().split(' ')))
	ls = sum(a)
	if ls >= 0:
		print('YES')
	else:
		print('NO')

def __starting_point():
	for _ in range(int(input())):
		solve()
__starting_point()