Chef likes problems which using some math. Now he asks you to solve next one. You have 4 integers, Chef wondering is there non-empty subset which has sum equals 0.

-----Input-----
The first line of input contains T - number of test cases. 
Each of the next T lines containing four pairwise distinct integer numbers - a, b, c, d.

-----Output-----
For each test case output "Yes", if possible to get 0 by choosing non-empty subset of {a, b, c, d} with sum equal 0, or "No" in another case.

-----Constraints-----
- 1 ≤ T ≤ 103
- -106 ≤ a, b, c, d ≤ 106 

-----Example-----
Input:
3
1 2 0 3
1 2 4 -1
1 2 3 4

Output:
Yes
Yes
No

-----Explanation-----
Example case 1. We can choose subset {0} 
Example case 2. We can choose subset {-1, 1}

Difficulty: interview

Starter code:

Solutions:
# cook your dish here

# cook your dish here

 

t = int(input())
while t:
 t-=1
 c=0
 ar=[int(i) for i in input().strip().split()]
 for i in range(1,16):
  b=bin(i)[2:].zfill(4)
  s=0
  for i in range(4):
   if b[i]=='1':
    s+=ar[i]
  
  if(s==0):
   c=1
   break
 
 print("Yes" if c==1 else "No")


def subset(n,s,l):
 t=1<<n
 for i in range(1,t):
  temp=0
  for j in range(n):
   if i&(1<<j):
    temp+=l[j]
  if temp==s:
   return True
 return False
for _ in range(int(input())):
 l=list(map(int,input().split()))
 #l.sort()
 print("Yes" if subset(len(l),0,l) else "No")

def subset(n,s,l):
 for i in range(1,2**n):
  temp=0
  for j in range(n):
   if i&(1<<j):
    temp+=l[j]
  if temp==s:
   return True
 return False
for _ in range(int(input())):
 l=list(map(int,input().split()))
 #l.sort()
 print("Yes" if subset(len(l),0,l) else "No")

# cook your dish here
for _ in range(int(input())):
 arr= list(map(int,input().strip().split()))
 flag=1
 for p in range(1,16):
  sum=0
  for i in range(0,4):
   f=1<<i
   if (p&f)!=0:
    sum+=arr[i]
  if sum==0:
   flag=0
   print("Yes")
 if flag==1:
  print("No")


# cook your dish here
def ss(a,su,i,cnt):
 if su==0 and cnt!=0:
  return 1
 if i<0:
  return 0
 return ss(a,su+a[i],i-1,cnt+1)+ss(a,su,i-1,cnt)
for _ in range(int(input())):
 a=[int(x) for x in input().split()]
 if ss(a,0,3,0):
  print("Yes")
 else:
  print("No")

# cook your dish here
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq
import sys 
input=sys.stdin.readline
 
def ri():
 return int(input())
 
def rl():
 return list(map(int, input().split()))
 
 

t =ri()
for _ in range(t):
 aa = rl()
 n = len(aa)
 answer = "No"
 for mask in range(1, 2**n):
  sum = 0
  for k in range(n):
   if mask & (1 << k):
    sum += aa[k]
  if sum == 0:
   answer = "Yes"
   break
 print(answer)

for _ in range(int(input())):
 a=list(map(int,input().split()))
 c=0
 for i in range(1,16):
  s=0
  for j in range(4):
   if i & (1<<j): 
    s+=a[j]
  if s==0:
   c=1
   print("Yes")
   break
 if c==0:
  print("No")

# cook your dish here
for h in range(int(input())):
 a,b,c,d=map(int,input().split())
 if a+b+c+d==0 or a+b+c==0 or a+b==0 or a==0:
  print('Yes')
 elif b==0 or c==0 or d==0 or a+c==0 or a+d==0 or a+b+d==0:
  print('Yes')
 elif a+c+d==0 or b+c+d==0 or b+c==0 or b+d==0 or c+d==0:
  print('Yes')
 else:
  print('No')

# cook your dish here
t=int(input())
for _ in range(t):
 a,b,c,d=list(map(int,input().split()))
 if a+b+c+d==0:
  print('Yes')
 elif a+b+c==0 or a+b+d==0 or b+c+d==0 or a+c+d==0:
  print('Yes')
 elif a+b==0 or a+c==0 or a+d==0 or b+c==0 or b+d==0 or c+d==0:
  print('Yes')
 elif a==0 or b==0 or c==0 or d==0:
  print('Yes')
 else:
  print('No')
 


for i in range(int(input())):
 a,b,c,d= list(map(int,input().split()))
 if a==0 or b==0 or c==0 or d==0:
  print('Yes')
 elif a+b+c+d==0:
  print('Yes')
 elif a+b+c==0 or a+b+d==0 or a+c+d==0 or b+c+d==0:
  print('Yes')
 elif a+b==0 or b+c==0 or c+d==0 or a+c==0 or a+d==0 or b+d==0:
  print('Yes')
 else:
  print('No')
  



t = int(input())
for _ in range(t):
 ar = list(map(int, input().split()))
 ok = False
 for i in range(1, 16):
  csum = 0
  for j in range(len(ar)):
   if (i & (1 << j)) > 0:
    csum += ar[j]
  if csum == 0:
   ok = True
   break
 if ok:
  print("Yes")
 else:
  print("No")

# cook your dish here
for _ in range(int(input())):
 a,b,c,d=list(map(int,input().split()))
 flag=0
 if a==0 or b==0 or c==0 or d==0:
  print('Yes')
  flag=1 
 l=[a,b,c,d]
 if flag==0:
  for i in range(len(l)):
   for j in range(i+1,len(l)):
    if l[i]+l[j]==0:
     print('Yes')
     flag=1
     break 
 if flag==0:
  if a+c+d==0 or b+c+d==0 or a+b+c==0 or a+b+d==0:
   flag=1 
   print('Yes')
 if flag==0:
  if a+b+c+d==0:
   print('Yes')
   flag=1 
 if flag==0:
  print('No')
 


# cook your dish here
t = int(input())
for _ in range(t):
 ar = list(map(int, input().split()))
 ok = False
 for i in range(1, 16):
  csum = 0
  for j in range(len(ar)):
   if (i & (1 << j)) > 0:
    csum += ar[j]
  if csum == 0:
   ok = True
   break
 if ok:
  print("Yes")
 else:
  print("No")

for _ in range(int(input())):
 a,b,c,d= [int(x) for x in input().split()]
 ls =[a,b,c,d]
 f =0
 for i in range(2**4):
  s =0
  arr =[]
  for j in range(4):
   if i & (1<<j) > 0:
    s+=ls[j]
    arr.append(ls[j])
  if s==0 and len(arr)>0:
   print("Yes")
   f=1
   break
 if f ==0:
  print("No")

# cook your dish here
t=int(input())
for _ in range(t):
 l=list(map(int,input().split(" ")))
 flag=False
 tot=1<<len(l)
 for i in range(tot):
  sum=0
  c=0
  for j in range(len(l)):
   k=1<<j
   if(i&k!=0):
    sum=sum+l[j]
    c=c+1
  if(sum==0 and c!=0):
   print("Yes")
   flag=True
   break
 if(flag==False):
  print("No")


# cook your dish here
for _ in range(int(input())):
 a=list(map(int, input().split()))
 n=4
 test=0
 for mask in range(1,1<<n):
  s=set()
  for i in range(n):
   f=1<<i
   if mask & f!=0:
    s.add(a[i])
  if sum(s)==0:
   test=1
   break
 if test:
  print('Yes')
 else:
  print('No')

# cook your dish here
for _ in range(int(input())):
 a = [int(x) for x in input().split()]
 n = 4
 tot = 1<<n
 flag = False
 for mask in range(tot):
  s =[]
  for i in range(n):
   f = 1<<i 
   if mask&f!=0:
    s.append(a[i])
  if len(s)!=0 and sum(s)==0:
   flag = True
   break
 if flag:print('Yes')
 else:print('No')

# cook your dish here
for _ in range(int(input())):
 a=list(map(int, input().split()))
 test=0
 n=4
 for mask in range(1,1<<n):
  s=0

  for i in range(n):
   if mask & 1<<i:
    s+=a[i]
  if s==0:
   test=1
   print('Yes')
   break
 if not test:
  print('No')

  
 


# cook your dish here
t = int(input())

POW = 1 << 4
for _ in range(t):
 nums = list(map(int,input().split(' ')))
 f = 1
 for k in range(POW):
  s = -1
  for i,j in enumerate(nums):
   f = 1 << i
   if f & k != 0:
    if s == -1:
     s = 0
    s += j
  # print('')
  if s == 0:
   f = 0
   break
 print(['No','Yes'][f == 0])



from itertools import combinations
for _ in range(int(input())):
 l=list(map(int,input().split()))
 c=0
 for i in range(1,5):
  if c:
   break
  a=list(combinations(l,i))
  for j in a:
   if sum(j)==0:
    c=1
    break
 if c:
  print('Yes')
 else:
  print('No')

# cook your dish here
t=int(input())
while(t):
 a=[int(x) for x in input().split()]
 tot=1<<4
 flag=0
 for i in range(1,tot):
  sum=0
  for j in range(4):
   f=1<<j
   if(f&i):
    sum+=a[j]
  if(sum==0):
   flag=1
   break
 print( 'Yes' if sum==0 else 'No') 
 t-=1

# cook your dish here
from itertools import permutations

def check_0(arr):
 if sum(arr)==0: return 'Yes'
 arr_len=len(arr)
 for perm in permutations(arr):
  for j in range(1,arr_len):
   if sum(perm[:j])==0: return 'Yes'
 return 'No'

for i in range(int(input())):
 arr=[int(x) for x in input().split()]
 print(check_0(arr))

# cook your dish here
t=int(input())
for x in range(t):
 m=0
 
 l=[int(i) for i in input().split()]
 for i in range(0,1<<4):
  ans=0
  for j in range(0,4):
   f=1<<j
   if i&f!=0:
    ans=ans+l[j]
    if ans==0:
     m=1
     print("Yes")
     break
  if m==1:
   break
 else:
  print("No")