The weather report of Chefland is *Good* if the number of sunny days in a week is strictly greater than the number of rainy days. 

Given 7 integers A_{1}, A_{2}, A_{3}, A_{4}, A_{5}, A_{6}, A_{7} where A_{i} = 1 denotes that the i^{th} day of week in Chefland is a sunny day, A_{i} = 0 denotes that the i^{th} day in Chefland is a rainy day. Determine if the weather report of Chefland is *Good* or not.

------ Input Format ------ 

- First line will contain T, number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input, 7 space separated integers A_{1}, A_{2}, A_{3}, A_{4}, A_{5}, A_{6}, A_{7}.

------ Output Format ------ 

For each testcase, print "YES" if the weather report of Chefland is Good, otherwise print "NO". Print the output without quotes.

You may print each character of the string in uppercase or lowercase (for example, the strings "yEs", "yes", "Yes" and "YES" will all be treated as identical).

------ Constraints ------ 

$1 ≤ T ≤ 20$
$0 ≤ A_{i} ≤ 1$

----- Sample Input 1 ------ 
4
1 0 1 0 1 1 1
0 1 0 0 0 0 1
1 1 1 1 1 1 1
0 0 0 1 0 0 0

----- Sample Output 1 ------ 
YES
NO
YES
NO
----- explanation 1 ------ 
Test case $1$: The number of sunny days is $5$ and the number of rainy days is $2$. Hence the weather report of Chefland is Good.

Test case $2$: The number of sunny days is $1$ and the number of rainy days is $6$. Hence the weather report of Chefland is not Good.

Difficulty: EASY
Tags: Implementation

Complete search
Skill types: Complete search

Starter code:

Solutions:
def main():
	t = input()
	for i in range(int(t)):
		week = input().split()
		icnt = 0
		for day in week:
			if int(day) == 1:
				icnt += 1
			else:
				icnt -= 1
		if icnt < 0:
			print('NO')
		else:
			print('YES')
main()


for i in range(int(input())):
	s = r = 0
	a = [int(x) for x in input().split()]
	for j in range(len(a)):
		if a[j] == 1:
			s += 1
		else:
			r += 1
	if s > r:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(map(int, input().split()))
	s = [n for n in a if n == 1]
	if len(s) > len(a) - len(s):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c, d, e, f, g) = map(int, input().split())
	l = [a, b, c, d, e, f, g]
	c1 = l.count(1)
	c0 = l.count(0)
	if c0 < c1:
		print('YES')
	else:
		print('NO')


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


for _ in range(int(input())):
	arr = list(map(int, input().split()))
	c1 = 0
	c2 = 0
	for i in arr:
		if i == 1:
			c1 += 1
		else:
			c2 += 1
	if c1 > c2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	li = list(map(int, input().split()))
	if li.count(1) > li.count(0):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = list(map(int, input().split()))
	o = 0
	z = 0
	for i in a:
		if i == 1:
			o = o + 1
		else:
			z = z + 1
	if o > z:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	A = map(int, input().split())
	Sunny_days = sum(A)
	rainy_days = 7 - Sunny_days
	if Sunny_days > rainy_days:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	L1 = map(int, input().split())
	c1 = c0 = 0
	for i in L1:
		if i == 1:
			c1 += 1
		else:
			c0 += 1
	if c1 > c0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a = input()
	b = a.split()
	if b.count('0') > b.count('1'):
		print('NO')
	else:
		print('YES')


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


for i in range(int(input())):
	l = list(map(int, input().split()))
	c = 0
	d = 0
	for i in range(len(l)):
		if l[i] == 1:
			c += 1
		else:
			d += 1
	if c > d:
		print('YES')
	else:
		print('NO')


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


n = int(input())
for z in range(n):
	a = list(map(int, input().split()))
	j = 0
	k = 0
	for i in a:
		if i == 1:
			j += 1
		else:
			k += 1
	if j > k:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	a = list(map(int, input().split()))
	sun = 0
	rain = 0
	for i in a:
		if i == 0:
			rain += 1
		else:
			sun += 1
	if sun > rain:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	a = list(map(int, input().split(' ')))
	s = a.count(1)
	r = a.count(0)
	if s > r:
		print('YES')
	else:
		print('NO')


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


for i in range(int(input())):
	l = list(map(int, input().split()))
	count1 = 0
	count2 = 0
	for i in l:
		if i == 0:
			count1 += 1
		else:
			count2 += 1
	if count1 > count2:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	(a, b, c, d, e, f, g) = map(int, input().split())
	p = []
	p.extend((a, b, c, d, e, f, g))
	if p.count(1) > p.count(0):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(sunny, rainy) = (0, 0)
	A = list(map(int, input().split()))
	for i in A:
		if i == 1:
			sunny += 1
		else:
			rainy += 1
	if sunny > rainy:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	x = list(map(int, input().split()))
	s = 0
	p = 0
	for i in range(len(x)):
		if x[i] == 1:
			s += 1
		else:
			p += 1
	if s > p:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d, e, f, g) = map(int, input().split())
	x = a + b + c + d + e + f + g
	if x > 3:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	s = 0
	r = 0
	a = list(map(int, input().split()))
	for j in range(7):
		if a[j] == 1:
			s = s + 1
		elif a[j] == 0:
			r = r + 1
	if s > r:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(map(int, input().split()))
	x = 0
	y = 0
	for i in range(7):
		if a[i] == 0:
			x += 1
		else:
			y += 1
	if x < y:
		print('YES')
	else:
		print('NO')


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


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


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	o = 0
	z = 0
	for i in l:
		if i == 1:
			o += 1
		elif i == 0:
			z += 1
	if o > z:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	m = list(map(int, input().split()))
	ones = list(filter(lambda x: x == 1, m))
	zeros = list(filter(lambda x: x == 0, m))
	if len(ones) > len(zeros):
		print('YES')
	else:
		print('NO')


d = int(input())
for i in range(d):
	t = map(int, input().split())
	w = w0 = 0
	for i in t:
		if i == 1:
			w += 1
		else:
			w0 += 1
	if w > w0:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	weather = list(map(int, input().split()))
	z = weather.count(1)
	if z < 4:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(0, t):
	a = list(map(int, input().strip().split()))[:7]
	a.sort(reverse=True)
	if a[3] == 0:
		print('NO')
	else:
		print('YES')