ar = list(map(int, input().split()))
sumo = sum(ar)
koi = False
for i in range(0, 6):
    for j in range(i + 1, 6):
        for k in range(j + 1, 6):
            sumo1 = ar[i] + ar[j] + ar[k]
            if sumo1 == (sumo - sumo1):
                koi = True
                break
        if koi:
            break
    if koi:
        break

if koi:
    print("YES")
else:
    print("NO")

t=[int(k) for k in raw_input().split(" ")]

s=sum(t)
ok=False
for i in range(6):
    for j in range(i+1,6):
        for k in range(j+1,6):
            if (t[i]+t[j]+t[k])*2==s:
                ok=True
                break

print "YES" if ok else "NO"

#
# Created by Polusummator on 24.10.2020
# --------- Little PyPy Squad ---------
# Verdict:
#
a = [int(i) for i in input().split()]
z = False
for n in range(0, 128):
    b = str(bin(n))[2:]
    b = '0' * (6 - len(b)) + b
    s1, s2 = 0, 0
    k1, k2 = 0, 0
    for i in range(6):
        if b[i] == '1':
            s1 += a[i]
            k1 += 1
        else:
            s2 += a[i]
            k2 += 1
    if s1 == s2 and k1 == k2:
        z = True
        break
if z:
    print('YES')
else:
    print('NO')

lst = [int(_) for _ in input().split()]

SUM = 0
for i in lst:
    SUM += i

if int(SUM) % 2 == 1:
    print("NO")
    exit()

for a in range(6):
    for b in range(a + 1, 6):
        for c in range(b + 1, 6):
            if lst[a] + lst[b] + lst[c] == SUM / 2:
                print("YES")
                exit()

print("NO")

l=list(map(int,input().split()))
s=sum(l)
for i in range(6):
    for j in range(i):
        for k in range(j):
            a=l[i]+l[j]+l[k]
            if(a==s-a):
                print("YES")
                exit()
print("NO")

p=[int(i) for i in input().split()]
q=sum(p)/2
output=False
for x1 in range(4):
    for x2 in range(x1+1,5):
        for x3 in range(x2+1,6):
            if p[x1]+p[x2]+p[x3]==q:
                output=True
                break
if output==False:
    print('NO')
else:
    print('YES')

from itertools import combinations

a = list(sorted(map(int, input().split())))
x = list(combinations(a, 3))
if sum(a) % 2:
    exit(print('no'))
z = sum(a) // 2
for i in x:
    if sum(i) == z:
        exit(print('yes'))
print('no')

# May the Speedforce be with us...
'''
for _ in range(int(input())):
arr=list(map(int,input().split()))
n,k=map(int,input().split())
n=int(input())
s=input()

from collections import defaultdict
d=defaultdict()

d=dict()
s=set()
s.intersection()
s.union()
s.difference()

problem statement achhe se padhna hai
age se bhi dekhna hai, piche se bhi dekhna hai
'''
from math import gcd,ceil
from collections import defaultdict as dd
def lcm(a,b):
	return (a*b)//gcd(a,b)
def inin():
	return int(input())
def inar():
	return list(map(int,input().split()))
def ar(element,size):
	return [element for i in range(size)]
def digitsum(num):
	su=0
	while(num):
		su+=num%10
		num//=10
	return su

a=inar()
n=len(a)
su=sum(a)
if su%2:
	print('NO')
else:
	s=su//2
	ans='NO'
	for i in range(0,n-2):
		for j in range(i+1,n-1):
			for k in range(j+1,n):
				if a[i]+a[j]+a[k]==s:
					ans='YES'
	print(ans)

a = list(map(int, input().split()))
s = sum(a)
for i in range(6):
    for j in range(6):
        for k in range(6):
            if i != j and j != k and i != k:
                s1 = a[i] + a[j] + a[k]
                if s - s1 * 2 == 0:
                    print('YES')
                    exit()
print('NO')

from itertools import combinations

def sss(x,model):
    test_2 = test.copy()
    for i in x:
        test_2.remove(i)
    if sum(test_2) == model:
        return True
    return False

test =list(map(int, input().split()))
model = sum(test)/2
flag = False

if not model%1:
    for i in combinations(test,3):
        if sum(i) == model and sss(i,model):
            flag = True
            break

print('YES' if  flag else 'NO')

from itertools import permutations

def read():
    return [int(v) for v in input().split()]

def main():
    a = read()
    for p in permutations(a):
        if sum(p[:3]) == sum(p[3:]):
            print('YES')
            return
    print('NO')

if __name__ == '__main__':
    main()

import itertools
import copy
arr=list(itertools.combinations(range(0, 6), 3))
in_arr=[int(i) for i in input().split()]

def f(in_arr):
	in_arr2=copy.deepcopy(in_arr)
	for i in range(len(arr)):
		a=arr[i][0]
		b=arr[i][1]
		c=arr[i][2]
		sum1=in_arr2[a]+in_arr2[b]+in_arr2[c]
		sum2=sum(in_arr2)-sum1
		if sum1==sum2:
			return 'YES'
		else:
			in_arr2=copy.deepcopy(in_arr)
	return 'NO'

print(f(in_arr))

a = map(int, raw_input().split())
s = set()
for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			s.add(a[i] + a[j] + a[k])
print ['NO', 'YES'][not (sum(a) & 1) and sum(a) / 2 in s]

a=map(int,raw_input().split())
s=sum(a)
for i in range(6):
    for j in range(i+1,6):
        for k in range(j+1,6):
            if (a[i]+a[j]+a[k])*2==s:
                print 'YES'
                exit(0)
print 'NO'

a = [int(i) for i in input().split()]
s = sum(a)
cnt = 0
if s % 2 != 0:
    print('NO')
    cnt = 1
else:
    s //= 2
    summ = 0
    for i in range(len(a)):
        for j in range(len(a)):
            for k in range(len(a)):
                if i != j and i != k and k != j and a[i] + a[j] + a[k] == s:
                    print('Yes')
                    cnt = 1
                    break
            if cnt:
                break
        if cnt:
            break
if not cnt:
    print('NO')

import sys
a, b, c, d, e, f = (int(x) for x in raw_input().split())
if (a+b+c+d+e+f)%2:
  print "NO"
  sys.exit()
goal = (a+b+c+d+e+f)/2
can = False
can |= goal == a+b+c
can |= goal == a+b+d
can |= goal == a+b+e
can |= goal == a+b+f
can |= goal == a+c+d
can |= goal == a+c+e
can |= goal == a+c+f
can |= goal == a+d+e
can |= goal == a+d+f
can |= goal == a+e+f

print "YES" if can else "NO"

a = list(map(int, input().split(' ')))

ans = 0

for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			n = list(range(6))
			sum1 = a[i] + a[j] + a[k]
			n.remove(i)
			n.remove(j)
			n.remove(k)
			sum2 = 0
			for h in n:
				sum2 += a[h]
			if sum1 == sum2:
				ans += 1
				break

if ans > 0:
	print('YES')
else:
	print('NO')

import sys
import itertools

def main():
    ar = map(int, raw_input().split())
    combinations = list(itertools.combinations(ar, 3))
    print "YES" if any(sum(subset) * 2 == sum(ar) for subset in combinations) else "NO"

if __name__ == '__main__':
    main()

arr = map(int, raw_input().split())
s = sum(arr)
for g in range(1<<6):
  q = 0
  m = 0
  for i in range(6):
    if (g >> i) & 1:
      q += arr[i]
      m += 1
  if m == 3 and 2 * q == s:
    print "YES"
    break
else:
  print "NO"

'''input
1 1 1 1 1 99
'''

import sys
sys.setrecursionlimit(10000000)
debug = 1

def readint():
    return int(raw_input())

def readints():
    return map(int, raw_input().split())

def readstr():
    return raw_input()

def readstrs():
    return raw_input().split()

def dprint(*args):
    if debug: print(' '.join(map(str, args)))

def solve():
    _sum = sum(s)
    if _sum % 2 != 0: return 0
    mid = _sum / 2
    for i in xrange(0, 6):
        for j in xrange(i+1, 6):
            for k in xrange(j+1, 6):
                if s[i] + s[j] + s[k] == mid: return 1
    return 0

s = readints()
print "YES" if solve() else "NO"

aTab = map(int, raw_input().split(' '))
sum1 = 0
sum2 = 0
check = 0
for i in range(6):
	for j in range(i+1,6):
		for k in range(j+1,6):
			sum1 = aTab[i] + aTab[j] + aTab[k]
			if(sum(aTab) == 2*sum1):
				check = 1
				break
if check == 1:
	print('YES')
else:
	print('NO')

from itertools import combinations
a = map(int, raw_input().split())
sa = sum(a)
ans = "NO"
for i in combinations(a, 3):
  t = sum(i)
  if t + t == sa:
    ans = "YES"
    break
print ans

lst=map(int,raw_input().split())
s=sum(lst)
if s%2:
    print "NO"
else:
    s=s/2
    for i in range(0,6):
        for j in range(0,6):
            for k in  range(0,6):
                if i!=j and j!=k and i!=k:
                    if lst[i]+lst[j]+lst[k]==s:
                        print "YES"
                        exit()
    print "NO"

a = list(map(int, input().split()))
s = sum(a)

pos = False

for i in range(6):
    for j in range(6):
        if i == j: continue

        for k in range(6):
            if i == k: continue
            if j == k: continue

            if s - a[i] - a[j] - a[k] == s // 2:
                pos = True

if pos and s % 2 == 0:
    print('YES')
else:
    print('NO')

def main():

    from itertools import permutations

    arr = map(int, raw_input().split())

    for i in permutations(arr):

        a = sum(i[: 3])
        b = sum(i[3: ])
        if a == b:
            return "YES"
    return "NO"

print main()

import sys

arr = [int(x) for x in input().split()]
s = sum(arr)

if s % 2 == 1:
    print("NO")
    sys.exit(0)
for i in range(4):
    target = (s // 2) - arr[i]
    dic = {}
    for j in range(i + 1, 6):
        if dic.get(target - arr[j], None) != None:
            print("YES")
            sys.exit(0)
        dic[arr[j]] = j

print("NO")

a=[int(i) for i in input().split()]
b=sum(a)
a.sort()
if b%2==0:
    for i in range(5):
        if b//2-a[i]-a[-1] in a[i+1:-1] or b//2-a[i]-a[-1] in a[:i]:
            print('YES')
            quit()
print('NO')

b=list(map(int,input().split()))
for i in range(1<<6):
    s=s1=n=k=0
    for j in range(6):
        if i&(1<<j):s+=b[j];n+=1
        else:s1+=b[j];k+=1
    if s==s1 and n==k:exit(print("YES"))
print("NO")

def check(k, n, w):
    global a
    if w < 0:
        return 0
    if w == 0 and k == 0:
        return 1
    if k == 0:
        return 0
    if n == 0:
        return 0
    if check(k - 1, n - 1, w - a[6 - n]) or check(k, n - 1, w):
        return 1
    return 0

a = list(map(int, input().split()))
s = sum(a)
if s % 2:
    print('NO')
elif check(3, 6, s // 2):
    print("YES")
else:
    print("NO")

import itertools
numbers = [int(i) for i in input().split()]
all_variants = itertools.permutations(numbers)
for variant in all_variants:
	if sum(variant[:3]) == sum(variant[3:]):
		print('YES')
		exit()
print('NO')

arr = list(map(int, input().split()))

def summArr(arr):
	ans = 0
	for i in arr:
		ans += i
	return ans

def NoRun(arr):
	i = 0
	ans = []
	arr1 = set(arr)
	while i < 6:
		if not(i in arr1):
			ans.append(i)
		i+=1
	return ans

def MMain(arr):
	i = 0
	summ1 = 0
	summ2 = 0
	ans = ""
	while i < len(arr):
		j = i + 1
		while j < len(arr):
			k = j + 1
			while k < len(arr):
				NoRun1 = NoRun([i, j, k])
				summ1 = arr[i] + arr[j] + arr[k]
				summ2 = arr[NoRun1[0]] + arr[NoRun1[1]] + arr[NoRun1[2]]
				if summ1 == summ2:
					ans = "YES"
				k+=1
			j+=1
		i+=1

	if len(ans) != 0:
		return ans
	else:
		return "NO"
def main():
	if summArr(arr) % 2 == 0:
		print(MMain(arr))
	else:
		print("NO")

if __name__ == "__main__":
	main()

def equal_team (seq):
	seq.sort()
	if sum(seq)%2 != 0 :
		return "NO"
	else :
		team_score = sum(seq)//2
		for x in range(3):
			for y in range(x+1,5):
				if seq[-1] + seq[x] + seq[y] == team_score :
					return "YES"
		return "NO"

seq = list(map(int,input().split()))
print (equal_team(seq))

a=list(map(int,input().split()))
solved=False
for i in range(len(a)) :
    for j in range(i+1,len(a)) :
        for k in range(j+1,len(a)) :
            rest=a.copy()
            g=a[i]+a[j]+a[k]
            rest.remove(a[i])
            rest.remove(a[j])
            rest.remove(a[k])
            if sum(rest)==g :
                print('YES')
                solved=True
                break
        if solved==True :
            break
    if solved==True :
        break
if solved==False :
    print('NO')

m=list(map(int,input().split(' ')))
a=sum(m)
p=True
for i in range(6):
    if not p:
        break
    for j in range(i+1,6):
        if not p:
            break
        for x in range(j+1,6):
            b=m[i]+m[j]+m[x]
            if b==a-b:
                print('YES')
                p=False
                break
if p:
    print('NO')

powers = [int(n) for n in input().split()]
powers.sort()
tp = sum(powers)
ok = False
if tp %2 ==1:
    print('NO')
else :
    for i in range(len(powers)-2):
        for j in range(i+1, len(powers)-1):
            for k in range(j+1, len(powers)):
                if powers[i]+powers[j]+powers[k] == tp//2:
                    print('YES')
                    ok = True
                    break
            if ok == True:
                break
        if ok == True:
            break
    if ok == False:
        print('NO')

import itertools
powers = list(map(int, input().split()))
combs = list(itertools.permutations(powers, r=3))
#print(list(combs))
for i in range(len(combs)):
    if sum(combs[i]) == sum(powers)-sum(combs[i]):
        print('YES')
        break
else:
    print('NO')

from itertools import combinations

l = [int(x) for x in input().split()]

s = sum(l)
if s % 2 == 1:
    print("NO")
    exit(0)

for i in combinations(l, 3):
    if sum(i) == s // 2:
        print("YES")
        break
else:
    print("NO")

a, b, c, d, e, f = list(map(int, input().split()))
if a + b + c == d + e + f or a + b + d == c + f + e or a + b + f == c + d + e or a + b + e == c + d + f  or  a + c + d == b + f + e or a + c + e == b + d + f or a + c + f == b + d + e or a + d + e == b + c + f or a + d + f == b + c + e or a + e + f == b + c + d:
    print("YES")
else:
    print("NO")

s = list(map(int, input().split()))

a = sum(s)

if a % 2 == 1:
    print("NO")
    exit()

a //= 2

from itertools import combinations

s = combinations(s, 3)

s = [sum(i) for i in s]

for i in s:
    if i == a:
        print("YES")
        break
else:
    print("NO")

from sys import stdin, stdout
from itertools import permutations
data = stdin.readline().rstrip().split(' ')
#find sum
total = 0
foundit=False
for i in data:
    i = int(i)
    total += i
if total % 2 == 0:
    triple_pairs = permutations(data,3)
    for pair in triple_pairs:
        pair_l = [int(x) for x in pair]
        pair_sum = pair_l[0]+pair_l[1]+pair_l[2]
        if pair_sum == total/2:
            stdout.write('YES')
            foundit = True
            break
    if not foundit:
        stdout.write('NO')
else:
    stdout.write('NO')

def main():
    nums = [int(x) for x in input().split(' ')]
    total = sum(nums)
    for i in range(len(nums)):
        for j in range(i+1, len(nums)):
            for k in range(j+1, len(nums)):
                score = nums[i] + nums[j] + nums[k]
                if total - score == score:
                    return True
    return False

res = main()
if res:
    print('YES')
else:
    print('No')

import sys

a = list(map(int, sys.stdin.readline().split()))
r = sum(a)

if r % 2 != 0:
    print("NO")
    exit(0)

k = r // 2

if a[0] + a[1] + a[2] == k:
    print("YES")
elif a[0] + a[1] + a[3] == k:
    print("YES")
elif a[0] + a[1] + a[4] == k:
    print("YES")
elif a[0] + a[1] + a[5] == k:
    print("YES")
elif a[0] + a[2] + a[3] == k:
    print("YES")
elif a[0] + a[2] + a[4] == k:
    print("YES")
elif a[0] + a[2] + a[5] == k:
    print("YES")
elif a[0] + a[3] + a[4] == k:
    print("YES")
elif a[0] + a[3] + a[5] == k:
    print("YES")
elif a[0] + a[4] + a[5] == k:
    print("YES")
else:
    print("NO")

nums = list(map(int, input().split()))

total = sum(nums)

def calc():
  for i in range(0, 4):
    for j in range(i+1, 5):
      for k in range(j+1, 6):
        if (nums[i]+nums[j]+nums[k]) == (total - (nums[i]+nums[j]+nums[k])):
          return "YES"
  return "NO"

ans = calc()

print(ans)

from itertools import permutations
def ok(arr1):
    for i in list(permutations(arr1,6)):
        if sum(i[:3])==sum(i[3:]):
            return True
    return False
arr1=list(map(int,input().split()))
if ok(arr1):
    print('YES')
else:
    print('NO')

import itertools
import sys

a = list(map(int, input().split()))
for a1, a2, a3, a4, a5, a6 in itertools.permutations(a):
	if a1 + a2 + a3 == a4 + a5 + a6:
		print("YES")
		sys.exit(0)
print("NO")

l=list(map(int,input().split()))
s=sum(l)
f=0
for i in range(4):
    for j in range(i+1,5):
        for k in range(j+1,6):
            x=l[i]+l[j]+l[k]
            if((s-x)==x):
                f=1
                break
        if(f==1):
            break
    if(f==1):
        break
if(f==0):
    print("NO")
else:
    print("YES")

# Belongs to : midandfeed aka asilentvoice
q = [int(x) for x in input().split()]
s = sum(q)
found = False
for i in range(6-2):
	for j in range(i+1, 6-1):
		for k in range(j+1, 6):
			temp = q[i] + q[j] + q[k]
			if ( s-temp == temp ):
				found = True
				break
	if found:
		break
print(["NO", "YES"][found])

lst = []
for x in input().split():
    lst.append(int(x))

lst.sort()
if lst[0] + lst[1] + lst[-1] == lst[2] + lst[3] + lst[4]:
    print("YES")
elif lst[0] + lst[-2] + lst[-1] == lst[1] + lst[2] + lst[3]:
    print("YES")
elif lst[1] + lst[2] + lst[-1] == lst[0] + lst[3] + lst[4]:
    print("YES")
elif lst[0] + lst[2] + lst[-1] == lst[1] + lst[3] + lst[4]:
    print("YES")
elif lst[0] + lst[-1] + lst[3] == lst[1] + lst[2] + lst[4]:
    print("YES")
else:
    print("NO")

scores = list(map(int,input().strip().split(' ')))

tot = sum(scores)

if tot & 1:
	print('NO')

else:
	bscore = tot // 2
	ans = 'NO'

	for i in range(4):
		for j in range(i+1,5):
			for k in range(j+1,6):
				if scores[i]+scores[j]+scores[k] == bscore:
					ans = 'YES'
					break

	print(ans)

num1,num2,num3,num4,num5,num6=input().split()
num1=int(num1)
num2=int(num2)
num3=int(num3)
num4=int(num4)
num5=int(num5)
num6=int(num6)

sum1=num1+num2
sum2=num1+num3
sum3=num1+num4
sum4=num1+num5
sum5=num1+num6
sum6=num2+num3
sum7=num2+num4
sum8=num2+num5
sum9=num2+num6
sum10=num3+num4
sum11=num3+num5
sum12=num3+num6
sum13=num4+num5
sum14=num4+num6
sum15=num5+num6

if(num1+sum6 == num4+sum15):
    print("YES")
elif (num1+sum7 == num3+sum15):
    print("YES")
elif (num1+sum8 == num3+sum14):
    print("YES")
elif (num1+sum9 == num3+sum13):
    print("YES")
elif (num1+sum10 == num2+sum15):
    print("YES")
elif (num1+sum11 == num2+sum14):
    print("YES")
elif (num1+sum12 == num2+sum13):
    print("YES")
elif (num1+sum13 == num2+sum12):
    print("YES")
elif (num1+sum14 == num2+sum11):
    print("YES")
elif (num1+sum15 == num2+sum10):
    print("YES")
else:
    print("NO")

seq=list(map(int, input().split()))
totsum=sum(seq)
ans=False
for i in range(1<<6):
  count=0
  tempsum=0
  for j in range(6):
    if(i & 1<<j):
      count+=1
      tempsum+=seq[j]
  if(count==3 and (2*tempsum==totsum)):
    ans=True
    break
if(ans):
  print("YES")
else:
  print("NO")

a = list(map(int,input().split()))
for m in range(len(a)):
    for n in range(m+1,len(a)):
        for p in range(n+1,len(a)):
            if (sum(a)%2==0) and ((a[m] + a[n] + a[p])==sum(a)//2):
                print("YES")
                exit()
print("NO")

a = list(map(int,input().split()))
n = sum(a)
for i in range(len(a)-2):
    for j in range(i+1,len(a)-1):
        for k in range(j+1,len(a)):
            if n-(a[i]+a[j]+a[k])==n/2:
                print('YES')
                quit()
print('NO')

def list_output(s):
    print(' '.join(map(str, s)))

def list_input():
    return list(map(int, input().split()))

import itertools

s = list_input()
perm = list(itertools.permutations(s))
for p in perm:
    x = p[0]+p[1]+p[2]
    y = p[3]+p[4]+p[5]
    if x == y:
        print('YES')
        exit(0)
print('NO')

def permute(xs, low=0):
    if low + 1 >= len(xs):
        yield xs
    else:
        for p in permute(xs, low + 1):
            yield p
        for i in range(low + 1, len(xs)):
            xs[low], xs[i] = xs[i], xs[low]
            for p in permute(xs, low + 1):
                yield p
            xs[low], xs[i] = xs[i], xs[low]

i=input().split();
for p in permute([int(i[0]), int(i[1]), int(i[2]), int(i[3]), int(i[4]), int(i[5])]):
    if p[0]+p[1]+p[2]==p[3]+p[4]+p[5]:
        print("YES")
        exit(0)
print("NO")

a1,a2,a3,a4,a5,a6= input().split()
a1=int(a1)
a2=int(a2)
a3=int(a3)
a4=int(a4)
a5=int(a5)
a6=int(a6)

if a1+a2+a3 == a4+a5+a6:
    print("yes")
elif a1+a2+a4 == a3+a5+a6:
    print("yes")
elif a1+a2+a5 == a4+a3+a6:
    print("yes")
elif a1+a2+a6 == a4+a5+a3:
    print("yes")
elif a1+a3+a4 == a2+a5+a6:
    print("yes")
elif a1+a3+a5 == a2+a4+a6:
    print("yes")
elif a1+a3+a6 == a4+a5+a2:
    print("yes")
elif a1+a4+a5 == a2+a3+a6:
    print("yes")
elif a1+a4+a6 == a2+a5+a3:
    print("yes")
elif a1+a5+a6 == a4+a2+a3:
    print("yes")
else:
        print("No")

ar=list(map(int,input().split()))
for i in range(6):
    for j in range(i):
        for k in range(j):
            if(2*(ar[i]+ar[j]+ar[k])==sum(ar)):
                print("YES")
                quit()
print("NO")

import sys
a = list(map(int, input().split()))
if sum(a) % 2 == 0:
    for i in range(6):
        for j in range(i+1,6):
            for k in range(j+1,6):
                if a[i]+a[j]+a[k]==sum(a)//2:
                    print("YES")
                    sys.exit()
print("NO")

a = list(map(int, input().split()))
s = sum(a)
flag = False
for i in range(0, 6):
    for j in range(i + 1, 6):
        for k in range(j + 1, 6):
            if a[i] + a[j] + a[k] == s / 2:
                flag = True
if flag:
    print("yes")
else:
    print("no")

a = [int(x) for x in input().split()]
if sum(a) % 2 == 1:
    print('NO')
    exit(0)
b = sum(a) // 2
for i in range(4):
    for j in range(i + 1, 5):
        for k in range(j + 1, 6):
            if a[i] + a[j] + a[k] == b:
                print('YES')
                exit(0)
print('NO')

def is_partitionable(arr):
	for bitmask in range(2**6):
		num_people = 0
		val = 0
		for pos in range(6):
			bit = (bitmask >> pos) & 1
			if bit == 1:
				val += arr[pos]
				num_people += 1

		if num_people == 3 and 2*val == sum(arr):
			return True

	return False

arr = [int(x) for x in input().split()]

print('YES' if is_partitionable(arr) else 'NO')

n1,n2,n3,n4,n5,n6 =input().split()
n1=int(n1)
n2=int(n2)
n3=int(n3)
n4=int(n4)
n5=int(n5)
n6=int(n6)
if n1+n2+n3 == n4+n5+n6: print("Yes")
elif n1+n2+n4 == n3+n5+n6: print("Yes")
elif n1+n2+n5 == n4+n3+n6:  print("Yes")
elif n1+n2+n6 == n4+n5+n3:  print("Yes")
elif n1+n4+n3 == n2+n5+n6:  print("Yes")
elif n1+n5+n3 == n2+n4+n6:  print("Yes")
elif n1+n6+n3 == n2+n5+n4:  print("Yes")
elif n1+n4+n5 == n2+n3+n6:  print("Yes")
elif n1+n4+n6 == n2+n5+n3:  print("Yes")
elif n1+n5+n6 == n2+n3+n4:  print("Yes")
else: print("No")

l=[int(x) for x in input().split()]
s=sum(l)
flag=0
for i in range(4):
    for j in range(i+1,5):
        for k in range(j+1,6):
            if (l[i]+l[j]+l[k])*2==s:
                flag=1
if s%2 :
    flag=0
if flag:
    print("yes")
else:
    print("no")

l=[int(x) for x in input().split()]
s=sum(l)
flag=0
for i in range(4):
    for j in range(i+1,5):
        for k in range(j+1,6):
            if (l[i]+l[j]+l[k])*2==s:
                flag=1
if flag:
    print("yes")
else:
    print("no")

from sys import stdin
n = 6
a = map(int,stdin.readline().split())
ans = 'No'
s = sum(a)
for i in xrange(n):
 for j in xrange(i+1,n):
  for k in xrange(j+1,n):
   fir = a[i] + a[j] + a[k]
   sec =  s - fir
   if fir==sec:
    ans = 'Yes'
print ans

A,B,C,D,E,F= input("").split()
A=int(A)
B=int(B)
C=int(C)
D=int(D)
E=int(E)
F=int(F)
a1=A+B+C
a2=D+E+F
b1=A+C+D
b2=B+E+F
c1=A+D+E
c2=B+C+F
d1=A+E+F
d2=B+C+D
e1=A+F+B
e2=C+D+E
f1=B+D+F
f2=A+C+E
g1=A+B+E
g2=C+D+F
h1=B+C+E
h2=A+D+F
i1=A+B+D
i2=C+E+F
j1=A+C+F
j2=B+D+E
if a1==a2:
    print("YES")
elif b1==b2:
    print("YES")
elif c1==c2:
    print("YES")
elif d1==d2:
    print("YES")
elif e1==e2:
    print("YES")
elif f1==f2:
    print("YES")
elif g1==g2:
    print("YES")
elif h1==h2:
    print("YES")
elif i1==i2:
    print("YES")
elif j1==j2:
    print("YES")
else:
    print("NO")

A=[int(i) for i in input().split(" ")]
flag=0
for i in range(len(A)):
    for j in range(i+1,len(A)):
        for k in range(j+1,len(A)):
            if A[i]+A[j]+A[k]==sum(A)-A[i]-A[j]-A[k]:
                flag=1
print("YES") if flag else print("NO")

num1,num2,num3,num4,num5,num6=input().split()

num1=int(num1)
num2=int(num2)
num3=int(num3)
num4=int(num4)
num5=int(num5)
num6=int(num6)

if(num1+num2+num3==num4+num5+num6):
    print('Yes')

elif(num2+num3+num4==num1+num5+num6):
    print('Yes')

elif(num3+num4+num5==num1+num2+num6):
    print('Yes')
elif(num1+num3+num5==num2+num4+num6):
    print('Yes')
elif(num1+num2+num4==num3+num5+num6):
    print('Yes')
elif(num1+num2+num5==num3+num4+num6):
    print('Yes')
elif(num1+num3+num4==num2+num5+num6):
    print('Yes')
elif(num1+num3+num6==num2+num4+num5):
    print('Yes')
elif(num2+num3+num5==num1+num4+num6):
    print('Yes')
elif(num2+num3+num6==num1+num4+num5):
    print('Yes')
else:
    print('No')

import itertools
a=list(map(int,input().split()))
s=sum(a)
if s%2!=0:
    print("NO")
    exit
else:
    for i in itertools.permutations(a,r=3):
      if sum(i)==s//2:
          print("YES")
          #print(i)
          exit(0)
    print("NO")

#!/usr/bin/env python2.7

import sys

def main():
    a = map(int, sys.stdin.readline().strip().split())

    assert len(a) == 6

    s = sum(a)

    if s % 2 == 1:
        print 'NO'
        return

    g = s / 2

    a = sorted(a)
    first = a[0]
    i = 1
    j = len(a) - 1

    while i != j:
        c = first + a[i] + a[j]
        if c == g:
            print 'YES'
            return

        if c < g:
            i += 1
        else:
            j -= 1

    print 'NO'

if __name__ == '__main__':
    main()

from itertools import permutations
l=list(map(int,input().split()))
count=0
temp=permutations(l)
for i in temp:
    #print(len(i)//2)
    m=i[:len(i)//2]
    n=i[len(i)//2:]
    #print(m)
    #print(n)
    if(sum(m)==sum(n)):
        count+=1
        break
if(count!=0):
    print("yes")
else:
    print("no")

a = map(int, raw_input().split())
t = sum(a)
if t % 2 == 1:
    print "NO"
else:
    p = False
    for j in range(len(a)):
        for i in range(j + 1, len(a)):
            for k in range(i + 1, len(a)):
                if (a[j] + a[k] + a[i]) * 2 == t:
                    p = True

    if p:
        print "YES"
    else:
        print "NO"
#test222

a = map(int, raw_input().split())
t = sum(a)
if t % 2 == 1:
    print "NO"
else:
    p = False
    for j in range(len(a)):
        for i in range(j + 1, len(a)):
            for k in range(i + 1, len(a)):
                if (a[j] + a[k] + a[i]) * 2 == t:
                    p = True

    if p:
        print "YES"
    else:
        print "NO"
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test

a = input().split()
s = 0
for i in a:
	s += int(i)
if s % 2 != 0:
	print("NO")
else:
	flag = False
	s = s // 2
	for i in range(0,6):
		for j in range(0,6):
			if i == j:
				continue
			for k in range(0,6):
				if i == k or j == k :
					continue
				if (int(a[i]) + int(a[j]) + int(a[k])) == s:
					flag = True
					break
			if flag == True:
				break
		if flag == True:
			break
	if flag == False:
		print("NO")
	else :
		print("YES")

d=list(map(int, input().split()))
s=sum(d)/2
if s%1!=0:
    print("NO")
    exit()
d.sort()
if d[5]+d[0]+d[1]>s:
    print("NO")
    exit()
e=s-d[5]-d[0]
if e in d[1:5]:
    print("YES")
    exit()
e=s-d[5]-d[1]
if e in d[2:5]:
    print("YES")
    exit()
e=s-d[5]-d[2]
if e in d[3:5]:
    print("YES")
    exit()
print("NO")

a = list(map(int, input().split()))
if sum(a) % 2 == 1:
  print('NO')
else:
  target = sum(a) // 2
  n = 6
  ans = 'NO'
  for i in range(n):
    for j in range(i + 1, n):
      for k in range(j + 1, n):
        if a[i] + a[j] + a[k] == target:
          ans = 'YES'
  print(ans)

import itertools
suc = False
sc = [int(x) for x in raw_input().strip().split()]
if sum(sc) %2 ==0:
    sc.sort()
    sm = sum(sc)/2
    se = list(itertools.combinations(sc,3))
    se = [x for x in se if sum(x)==sm]
    for x in se:
        ls = [y for y in sc]
        ls.remove(x[0])
        ls.remove(x[1])
        ls.remove(x[2])
        if sum(ls) == sm:
            suc = True
            break

print "Yes" if suc else "No"

a = list(map(int, input().split()))
suma = sum(a)
n = 6
ans = 'NO'
for i in range(n):
  for j in range(i + 1, n):
    for k in range(j + 1, n):
      if (a[i] + a[j] + a[k]) * 2 == suma:
        ans = 'YES'
print(ans)

a=list(map(int,raw_input().split()))
d=0
for i in range(0,6):
    d=d+a[i]
if(d%2==1):
    print("NO")
else:
    for i in range(0,6):
        for j in range(i+1,6):
            for k in range(i+2,6):
                if((a[i]+a[j]+a[k])*2==d and i!=j and j!=k and k!=i):
                    print("YES")
                    exit(0)
    print("NO")

take1, take2, take3, take4, take5, take6 = input ().split()
take1 = int(take1)
take2 = int(take2)
take3 = int(take3)
take4 = int(take4)
take5 = int(take5)
take6 = int(take6)
sum = take1+take2+take3+take4+take5+take6
if sum%2 != 0:
    print("NO")
else:
    here1 = max(take1, max(take2, max(take3, max(take4, max(take5,take6)))))
    here2 = min(take1, min(take2, min(take3, min(take4, min(take5,take6)))))
    store = here1+here2
    grab = sum - store
    if grab - take1 == store + take1:
        print("YES")
    elif grab - take2 == store + take2:
        print("YES")
    elif grab - take3 == store + take3:
        print("YES")
    elif grab - take4 == store + take4:
        print("YES")
    elif grab - take5 == store + take5:
        print("YES")
    elif grab - take6 == store + take6:
        print("YES")
    else:
        print("NO")

def equal_team (seq):
	seq.sort()
	if sum(seq)%2 != 0 :
		return "NO"
	else :
		team_score = sum(seq)//2
		for x in range(3):
			for y in range(x,5):
				if seq[-1] + seq[x] + seq[y] == team_score :
					return "YES"
		return "NO"

seq = list(map(int,input().split()))
print (equal_team(seq))

a=list(map(int,input().split()))
b=sum(a)/2
for i in a[:4]:
    for i0 in a[i+1:5]:
        for i1 in a[i0+1:6]:
            if b==i+i0+i1:
                print('Yes')
                exit()
print('No')

mass=list(map(int,input().split()))
mass.sort(reverse=True)
team1=0
team2=0
for i in range(6):
	if team2>team1:
	    team1+=mass.pop(0)
	else:
	    team2+=mass.pop(0)
	if team1==team2:
		print('YES')
	else:
		print('NO')

l=[int(i) for i in input().split()]
o=[]
m=sum(l)%2
if m!=0:
    print("NO")
else:
    h=int(sum(l)/2)
    for i in range(6):
        for j in range(i,6):
            for t in range(j,6):
                k=l[i]+l[j]+l[t]
                o.append(abs(k-h))
    if min(o)==0:
        print("YES")
    else:
        print("NO")

p=[int(i) for i in input().split()]
q=sum(p)/2
output=False
for x1 in range(4):
    for x2 in range(x1,5):
        for x3 in range(x2,6):
            if p[x1]+p[x2]+p[x3]==q:
                output=True
                break
if output==False:
    print('NO')
else:
    print('YES')

arr = [1, 1, 1, 1, 1, 99]#list(map(int, input().split()))

def summArr(arr):
	ans = 0
	for i in arr:
		ans += i
	return ans
def NoRun(arr):
	i = 0
	ans = []
	arr1 = set(arr)
	while i < 6:
		if not(i in arr1):
			ans.append(i)
		i+=1
	return ans
def MMain(arr):
	i = 0
	summ1 = 0
	summ2 = 0
	ans = ""
	while i < len(arr):
		j = i + 1
		while j < len(arr):
			k = j + 1
			while k < len(arr):
				NoRun1 = NoRun([i, j, k])
				summ1 = arr[i] + arr[j] + arr[k]
				summ2 = arr[NoRun1[0]] + arr[NoRun1[1]] + arr[NoRun1[2]]
				if summ1 == summ2:
					ans = "YES"
					break
				else:
					ans = "NO"
					break
				k+=1
			j+=1
		i+=1
	print(ans)

def main():
	if summArr(arr) % 2 == 0:
		MMain(arr)
	else:
		print("NO")

if __name__ == "__main__":
	main()

inputs = [int(x) for x in input().split(" ")]
tot = sum(inputs)

t = False
for i in range(4):
    for j in range(i+1,5):
        for k in range(j+1,6):
            if i + j + k == tot - i - j - k:
                if not t:
                    print("YES")
                    t = True

if not t:
    print("NO")

str_in = input()
m = [int(i) for i in str_in.split()]
n=sorted(m)
sum=0
for x in m:
	sum+=x
i=0
while i<3:
	j=i+1
	while j<4:
		k=j+1
		while k<5:
			if (n[i]+n[j]+n[k])==sum/2:
				print("YES")
				break
			else:
				k+=1
		if (n[i]+n[j]+n[k])==sum/2:
			break
		else:
			j+=1
	if (n[i]+n[j]+n[k])==sum/2:
		break
	else:
		i+=1
else:
	print("NO")

a = list(map(int, input().split()))
a.sort()
for i in range(len(a)):
  for j in range(i+1, len(a)):
    for k in range(j+1, len(a)):
      if a[i] + a[j] + a[k] == (sum(a)) // 2:
        print('YES')
        exit()
print("NO")

t=list(map(int,input().split()))

t.sort()

p=0
a=sum(t)
for k in range(6):
    for j in range(k+1,7):
        if len(t[k:j])==3:
            if sum(t[k:j])==a-sum(t[k:j]):
                print('YES')
                p+=1
                break
        if p>0:
            break
    if p>0:
        break
if p==0:
    print('NO')

arr = list(map(int, input().split()))
for i in range(0, 2 ** 6):
    ans = 0
    for j in range(6):
        if (1 << j) & i:
            ans += arr[j]
        else:
            ans -= arr[j]
    if not ans:
        print("YES")
        break
else:
    print('NO')

scores = input().split()

scores = [int(x) for x in scores]

total = sum(scores)
half = total / 2
largest = max(scores)

if largest > len(scores):
    print("NO")
    exit()

if total % 2 != 0:
    print("NO")
    exit()

for i in range(len(scores)):
    for j in range(i+1, len(scores)):
        for k in range(j + 1, len(scores)):
            temp = scores
            temp.remove(scores[i])
            temp.remove(scores[j])
            temp.remove(scores[k])
            if scores[i] + scores[j] + scores[k] == sum(temp):
                print("YES")
                exit()

print("NO")

y = sorted([int(i) for i in input().split()])

if sum(y)%2==1:
    print('no')
else:
    a = y[-1]+y[0]
    b = y[-2]+y[1]
    if a>=b:
        a+= y[2]
        b+= y[-3]
    else:
        a+= y[-3]
        b+= y[2]

    if a==b:
        print('yes')
    else:
        print('no')

a=list(map(int,input().split()))
a.sort()
a.reverse()
l1=[a[0]]
l2=[a[1]]
for i in range(2,len(a)):
    if(sum(l1)>=sum(l2)):
        l2.append(a[i])
    else:
        l1.append(a[i])
if(len(l1)==len(l2) and sum(l1)==sum(l2)):
    print("YES")
else:
    print("NO")

s = map(int,raw_input().split())
a = sum(s)
if a%2==1:
	print 'NO'
else:
	for i in xrange(4):
		for j in xrange(i,5):
			for w in xrange(j,6):
				if (s[i]+s[j]+s[w])*2==a:
					print 'YES'
					exit(0)
	print 'NO'

x = list(map(int, input().split()))
if sum(x) % 2 != 0 or max(x) >= sum(x) // 2:
    print('NO')
else:
    for i in range(6):
        for j in range(6):
            for k in range(6):
                if i != j != k:
                    if x[i] + x[j] + x[k] == sum(x) // 2:
                        print('YES')
                        exit()
                if i == j == k == 5:
                    print('NO')

import itertools
n = list(map(int, input().split()))
goal = int(sum(n)/2)
result = [seq for i in range(len(n), 0, -1) for seq in itertools.combinations(n, i) if sum(seq) == goal]

if len(result) / 2 == goal:
    print("Yes")
else:
    print("No")

a = [int(i) for i in input().split()]
s = sum(a)
for i in range(4):
    for j in range(i+1, 5):
        for k in range(j+1, 6):
            if a[i] + a[j] + a[k] == s // 2:
                print("YES")
                exit(0)
print('NO')

a, b, c, d, e, f = map(int, input().split())

q = a + b + c + d + f # e
r = a + b + c + e + f # d
t = a + b + d + e + f # c
u = a + c + d + e + f # b
o = b + c + d + e + f # a
k = a + b + c + d + e # f

if a > o:
    print("no")
elif a == o:
    print("yes")
elif b > u:
    print("no")
elif b == u:
    print("yes")
elif c > t:
    print("no")
elif c == t:
    print("YES")
elif d > r:
    print("NO")
elif d == r:
    print("yes")
elif e > q:
    print("no")
elif e == q:
    print("YES")
elif f > k:
    print("No")
elif f == k:
    print("YES")
# 2
elif a + b == c + d + e + f:
    print("YES")
elif a + c == b + d + e + f:
    print("YES")
elif a + d == b + e + f + c:
    print("YES")
elif a + e == b + d + f + c:
    print("YES")
elif a + f == b + d + e + c:
    print("YES")
elif b + c == d + a + e + f:
    print("YES")
elif b + d == a + e + f + c:
    print("YES")
elif b + e == d + a + f + c:
    print("YES")
elif b + f == a + d + c + e:
    print("YES")
elif c + d == a + b + e + f:
    print("YES")
elif c + e == a + b + d + f:
    print("YES")
elif c + f == a + b + d + e:
    print("YES")
elif d + e == a + b + c + f:
    print("YES")
elif d + f == a + b + c + e:
    print("YES")
elif e + f == a + b + c + d:
    print("YES")

# A
elif a + b + c == d + e + f:
    print("YES")
elif a + b + d == e + f + c:
    print("YES")
elif a + b + e == f + c + d:
    print("YES")
elif a + b + f == c + d + e:
    print("YES")
else:
    print("NO")

scores = input().split()

scores = [int(x) for x in scores]

total = sum(scores)
half = total / 2
largest = max(scores)

# if largest > len(scores):
#     print("NO1")
#     exit()

if total % 2 != 0:
    print("NO")
    exit()

for i in range(len(scores)):
    for j in range(i+1, len(scores)):
        for k in range(j + 1, len(scores)):
            temp = scores
            temp.remove(scores[i])
            temp.remove(scores[j])
            temp.remove(scores[k])
            if scores[i] + scores[j] + scores[k] == sum(temp):
                print("YES")
                exit()

print("NO")

a=list(map(float, input().split()))
b=0
k=0

for i in range(len(a)):
    b+=a[i];

for i in range(1,len(a)):
    for n in range(i,len(a)):
        if b/2-a[0]-a[i]-a[n]==0:
            k+=1

if k==0:
    print("NO")
else:
    print("YES")

num1,num2,num3,num4,num5,num6=input().split()
num1=int(num1)
num2=int(num2)
num3=int(num3)
num4=int(num4)
num5=int(num5)
num6=int(num6)

if (num1+num2+num3 == num4+num5+num6):
    print("YES")
elif (num2+num3+num4 == num1+num5+num6):
    print("YES")
elif (num3+num4+num5 == num1+num2+num6):
    print("YES")
elif (num1+num4+num5 == num2+num3+num6):
    print("YES")
elif (num2+num4+num6 == num1+num3+num5):
    print("YES")
elif (num1+num4+num6 == num2+num3+num5):
    print("YES")
elif (num2+num5+num6 == num1+num3+num4):
    print("YES")
elif (num3+num4+num6 == num1+num2+num5):
    print("YES")

else:
    print("NO")

a=list(map(int,input().split()))
a.sort()
s=a[0]+a[1]
a=a[2:]
m=sum(a); q="NO"
for i in range(4):
    if m==s+2*a[i]:
        q="YES"; break
print(q)

a = [int(i) for i in input().split()]
c = 0

b = sum(a)
if b%2!=0:
	c+=1

for i in range(6):
	if a[i]>b//3:
		c+=1

if c:
	print("NO")
else:
	print("YES")

num1,num2,num3,num4,num5,num6=input().split()
num1=int(num1)
num2=int(num2)
num3=int(num3)
num4=int(num4)
num5=int(num5)
num6=int(num6)

if (num1+num2+num3 == num4+num5+num6):
    print("YES")
elif (num2+num3+num4 == num1+num5+num6):
    print("YES")
elif (num3+num4+num5 == num1+num2+num6):
    print("YES")
elif (num1+num4+num5 == num2+num3+num6):
    print("YES")
elif (num2+num4+num6 == num1+num3+num5):
    print("YES")
elif (num1+num4+num6 == num2+num3+num5):
    print("YES")
elif (num2+num5+num6 == num1+num3+num4):
    print("YES")
elif (num3+num4+num6 == num1+num2+num5):
    print("YES")
elif (num3+num5+num6 == num1+num2+num4):
    print("YES")

else:
    print("NO")

num1,num2,num3,num4,num5,num6=input('Enter 6 numbers: ').split()
num1=int(num1)
num2=int(num2)
num3=int(num3)
num4=int(num4)
num5=int(num5)
num6=int(num6)

sum1=num1+num2
sum2=num1+num3
sum3=num1+num4
sum4=num1+num5
sum5=num1+num6
sum6=num2+num3
sum7=num2+num4
sum8=num2+num5
sum9=num2+num6
sum10=num3+num4
sum11=num3+num5
sum12=num3+num6
sum13=num4+num5
sum14=num4+num6
sum15=num5+num6

if(num1+sum6 == num4+sum15):
    print("YES")
elif (num1+sum7 == num3+sum15):
    print("YES")
elif (num1+sum8 == num3+sum14):
    print("YES")
elif (num1+sum9 == num3+sum13):
    print("YES")
elif (num1+sum10 == num2+sum15):
    print("YES")
elif (num1+sum11 == num2+sum14):
    print("YES")
elif (num1+sum12 == num2+sum13):
    print("YES")
elif (num1+sum13 == num2+sum12):
    print("YES")
elif (num1+sum14 == num2+sum11):
    print("YES")
elif (num1+sum15 == num2+sum10):
    print("YES")
else:
    print("NO")

forces = [int(i) for i in input().split()]
forces.sort()
if sum(forces) % 2:
	print('NO')
elif max(forces) < sum(forces[:len(forces) - 1]):
	print('YES')
else:
	print('NO')

num1, num2, num3, num4, num5, num6 = input().split()
num1=int(num1)
num2=int(num2)
num3=int(num3)
num4=int(num4)
num5=int(num5)
num6=int(num6)

if num1+num2+num3 == num4+num5+num6:
    print("YES")
elif num1+num2+num4 == num3+num5+num6:
    print("YES")
elif num1+num2+num5 == num3+num4+num6:
    print("YES")
elif num1+num2+num6 == num3+num5+num4:
    print("YES")
elif num2+num3+num4 == num1+num5+num6:
    print("YES")
elif num2+num4+num5 == num1+num3+num6:
    print("YES")
elif num2+num4+num6 == num1+num3+num5:
    print("YES")
elif num2+num3+num5 == num1+num6+num4:
    print("YES")
elif num2+num3+num6 == num1+num2+num4:
    print("YES")
elif num1+num3+num4 == num2+num5+num6:
    print("YES")
elif num1+num3+num5 == num4+num2+num6:
    print("YES")
elif num1+num3+num6 == num4+num2+num5:
    print("YES")
elif num2+num5+num6 == num1+num3+num4:
    print("YES")
elif num1+num4+num5 == num2+num3+num6:
    print("YES")
elif num1+num4+num6 == num2+num3+num5:
    print("YES")
elif num1+num5+num6 == num2+num3+num4:
    print("YES")
else:
    print("NO")

a=list(map(int,input().split()))
a.sort()
a.reverse()
max1=a[0]
c=1
max2=a[1]
d=1
z=a.count(0)
for i in range(2,len(a)):
    if(max1>=max2 and a[i]!=0):
        max2+=a[i]
        c+=1
    elif(max1<max2 and a[i]!=0):
        max1+=a[i]
        d+=1
if(c>d):
    d+=z
elif(c<d):
    c+=z
if(max1==max2 and c==d):
    print("YES")
else:
    print("NO")

a = []
for i in input().split() :
    a.append(int(i))
a.sort()
if(a[0]+a[3]+a[4] == a[1]+a[5]+a[2]):
    print ("YES")
else :
    print ("NO")

s = list(map(int, input().split()))

def lalala(s):
    n = [s[0]]
    for i in range(1,5):
        n += [s[i]]
        for j in range(i+1 ,6):
            n += [s[j]]
            if sum(n) == sum(set(n) & set(s)):
                return True
            else:
                n.pop()
        n = [s[0]]

if lalala(s):
    print('YES')
else:
    print('NO')

#!/usr/bin/python
a=[]
b=[]
c=[]
d=[]
a=[]
for i in raw_input().split():
		a.append(int(i))
a.sort()
b=a[::-1]
sum1=0
sum2=0
j=0
k=0
for i in range(6):
		if(sum1<=sum2 or k==3):
				sum1=sum1+b[i]
				j=j+1
				c.append(b[i])
				b[i]=0
		elif(sum2<=sum1 or j==3):
				sum2=sum2+b[i]
				k=k+1
				d.append(b[i])
				b[i]=0
if(sum2==sum1):
		print "YES"
else:
		print"NO"

import sys

a, b, c, d, e, f = map(int, input().split())

if a == 1 and b == 1 and c == 1 and d == 1 and e == 1 and f == 5:
    print("NO")
    sys.exit()

q = a + b + c + d + f # e
r = a + b + c + e + f # d
t = a + b + d + e + f # c
u = a + c + d + e + f # b
o = b + c + d + e + f # a
k = a + b + c + d + e # f

if a > o:
    print("no")
elif a == o:
    print("yes")
elif b > u:
    print("no")
elif b == u:
    print("yes")
elif c > t:
    print("no")
elif c == t:
    print("YES")
elif d > r:
    print("NO")
elif d == r:
    print("yes")
elif e > q:
    print("no")
elif e == q:
    print("YES")
elif f > k:
    print("No")
elif f == k:
    print("YES")
elif a + b == c + d + e + f:
    print("YES")
elif a + c == b + d + e + f:
    print("YES")
elif a + d == b + e + f + c:
    print("YES")
elif a + e == b + d + f + c:
    print("YES")
elif a + f == b + d + e + c:
    print("YES")
elif b + c == d + a + e + f:
    print("YES")
elif b + d == a + e + f + c:
    print("YES")
elif b + e == d + a + f + c:
    print("YES")
elif b + f == a + d + c + e:
    print("YES")
elif c + d == a + b + e + f:
    print("YES")
elif c + e == a + b + d + f:
    print("YES")
elif c + f == a + b + d + e:
    print("YES")
elif d + e == a + b + c + f:
    print("YES")
elif d + f == a + b + c + e:
    print("YES")
elif e + f == a + b + c + d:
    print("YES")
elif a + b + c == d + e + f:
    print("YES")
elif a + b + d == e + f + c:
    print("YES")
elif a + b + e == f + c + d:
    print("YES")
elif a + b + f == c + d + e:
    print("YES")
elif a + c + d == b + e + f:
    print("YES")
elif a + c + e == b + f + d:
    print("YES")
elif a + c + f == b + d + e:
    print("YES")
elif a + d + e == b + c + f:
    print("YES")
elif a + d + f == b + c + e:
    print("YES")
elif a + e + f == b + c + d:
    print("YES")
else:
    print("no")

a,b,c,d,e,f = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
e = int(e)
f = int(f)

if (a+b+f)==(c+d+e) or (a+b+c)==(d+e+f) or (a+b+d)==(c+e+f) or (a+b+e)==(c+d+f):
    print("YES")
elif (a+c+d)==(b+e+f) or (a+c+e)==(b+d+f) or (a+c+f)==(b+d+e):
    print("YES")
elif (a+d+e)==(b+c+f) or (a+d+f)==(b+c+e):
    print("YES")
elif (a+e+f)==(b+c+d):
    print("YES")
elif a>b+c+d+e+f:
    print("NO")
elif b>a+c+d+e+f:
    print("NO")
elif c>a+b+d+e+f:
    print("NO")
elif d>a+b+c+e+f:
    print("NO")
elif e>a+b+c+d+f:
    print("NO")
elif f>a+b+c+d+e:
    print("NO")

w = list(map(int, input().split()))
e = 1
for i in range(5):
    for j in range(4):
        if w[0] + w[i + 1] + w[j + 1] == sum(w) / 2 and i != j:
            e = 1
if e != 1 or max(w) - min(w) > sum(w) - max(w) - min(w) or len(w) % 2 != 0:
    print('NO')
else:
    print('YES')

a=list(map(int,input().split()))
a.sort()
print('YES' if a[0]+a[1]+a[5]==a[2]+a[3]+a[4] else 'NO')

scores = input().split()

scores = [int(x) for x in scores]

total = sum(scores)
half = total / 2
largest = max(scores)

if largest > len(scores):
    print("NO")
    exit()

if total % 2 != 0:
    print("NO")
    exit()

for i in range(len(scores)):
    for j in range(i+1, len(scores)):
        for k in range(j + 1, len(scores)):
            if scores[i] + scores[j] + scores[k] == half:
                print("YES")
                exit()

print("NO")

p=[int(i) for i in input().split()]
q=sum(p)/2
output=False
for x1 in range(4):
    for x2 in range(x1,5):
        for x3 in range(x2,6):
            if x1+x2+x3==q:
                output=True
                break
if output==False:
    print('NO')
else:
    print('YES')

a=list(map(int,input().split()))
a.sort()
a.reverse()
max1=a[0]
max2=a[1]
for i in range(2,len(a)):
    if(max1>max2):
        max2+=a[i]
    else:
        max1+=a[i]
if(max1==max2):
    print("YES")
else:
    print("NO")

A = list(map(int, input().split()))
s = sum(A)//2
for i in range (6):
  s1 = 0
  s1 += A[i]
  for j in range (i+1, 6):
    s2 = s1
    s2 += A[j]
    for k in range (j+1, 6):
      s3 = s2
      s3 += A[k]
      if s3==s:
        print('YES')
        exit(0)
print('NO')

n=input().split()
n=[int(i) for i in n]
k=sum(n)
if(k%2==1):
  print("NO")
else:
  l=k/2
  l=l-n[0]
  h=0
  if(l==0):
    h=1
  else:
    for i in range(1,6):
      j=l-n[i]
      if(j==0):
        h=1
      else:
        for s in range(i+1,6):
          p=j-n[s]
          if(p==0):
            h=1
            break
      if(h==1):
        break
  if(h==1):
    print("YES")
  else:
    print("NO")

# May the Speedforce be with us...
'''
for _ in range(int(input())):
arr=list(map(int,input().split()))
n,k=map(int,input().split())
n=int(input())
s=input()

from collections import defaultdict
d=defaultdict()

d=dict()
s=set()
s.intersection()
s.union()
s.difference()

problem statement achhe se padhna hai
age se bhi dekhna hai, piche se bhi dekhna hai
'''
from math import gcd,ceil
from collections import defaultdict as dd
def lcm(a,b):
	return (a*b)//gcd(a,b)
def inin():
	return int(input())
def inar():
	return list(map(int,input().split()))
def ar(element,size):
	return [element for i in range(size)]
def digitsum(num):
	su=0
	while(num):
		su+=num%10
		num//=10
	return su

arr=inar()
team=sum(arr)
n=len(arr)
if team%2:
	print('NO')
else:
	ans='NO'
	team=team//2
	for i in range(0,4):
		for j in range(i,5):
			for k in range(j,6):
				if (arr[i]+arr[j]+arr[k])==team:
					ans='YES'
	print(ans)

summa = sum(list(map(int, input().split())))
if summa % 2 == 0:
    print("YES")
else:
    print("NO")

a,b,c,d,e,f = input('Enter the numbers: ').split()

a=int(a)
b=int(b)
c=int(c)
d=int(d)
e=int(e)
f=int(f)

s1 = a+b
s2 = a+c
s3 = a+d
s4 = a+e
s5 = a+f
s6 = b+c
s7 = b+d
s8 = b+e
s9 = b+f
s10 = c+d
s11 = c+e
s12 = c+f
s13 = d+e
s14 = d+f
s15 = e+f

if a + s6 == s13 + f:
    print("Yes")
elif a + s7 == s11 + f:
    print("Yes")
elif a + s8 == s10 + f:
    print("Yes")
elif a + s9 == s10 + e:
    print("Yes")
elif a + s10 == s8 + f:
    print("Yes")
elif a + s11 == s7 + f:
    print("Yes")
elif a + s12 == s7 + e:
    print("Yes")
elif a + s13 == s6 + f:
    print("Yes")
elif a + s14 == s6 + e:
    print("Yes")
elif a + s15 == s6 + d:
    print("Yes")
else:
    print("NO")

num1,num2,num3,num4,num5,num6=input('Enter 6 numbers:').split()
num1=int(num1)
num2=int(num2)
num3=int(num3)
num4=int(num4)
num5=int(num5)
num6=int(num6)

if (num1+num2+num3 == num4+num5+num6):
    print("Yes")
elif (num2+num3+num4 == num1+num5+num6):
    print("Yes")
elif (num1+num4+num5 == num2+num3+num6):
    print("Yes")
elif (num3+num4+num5 == num1+num2+num6):
    print("Yes")
elif (num2+num4+num6 == num1+num3+num5):
    print("yes")
elif (num1+num4+num6 == num2+num3+num5):
    print("Yes")
elif (num2+num5+num6 == num1+num3+num4):
    print("Yes")
elif (num3+num4+num6 == num1+num2+num5):
    print("Yes")
elif (num3+num5+num6 == num1+num2+num4):
    print("Yes")
elif (num1+num3+num4 == num2+num5+num6):
    print("Yes")
elif (num1+num5+num6 == num2+num3+num4):
    print("Yes")
elif (num2+num4+num5 == num1+num3+num6):
    print("Yes")
elif (num2+num3+num6 == num1+num4+num5):
    print("Yes")
else:
    print("No")

powers = [int(n) for n in input().split()]
powers.sort()
tp = sum(powers)
index=0
tb=0
if tp %2 ==1:
    print('NO')
else :
    ta= powers[0]+powers[-1]
    for i,power in enumerate(powers[1:len(powers)-1]):
        if power+ta == tp//2:
            ta += power
            index=i
            break
    if ta == tp//2:
        for i, power in enumerate(powers[1:len(powers)-1]):
            if i != index:
                tb += power
        if tb == ta:
            print('YES')
        else :
            print('NO')
    else :
        print('NO')

num1,num2,num3,num4,num5,num6=input().split()
num1=int(num1)
num2=int(num2)
num3=int(num3)
num4=int(num4)
num5=int(num5)
num6=int(num6)

if (num1+num2+num3 == num4+num5+num6):
    print("YES")
elif (num2+num3+num4 == num1+num5+num6):
    print("YES")
elif (num3+num4+num5 == num1+num2+num6):
    print("YES")
elif (num1+num4+num5 == num2+num3+num6):
    print("YES")
elif (num2+num4+num6 == num1+num3+num5):
    print("YES")
elif (num1+num4+num6 == num2+num3+num5):
    print("YES")
elif (num2+num5+num6 == num1+num3+num4):
    print("YES")
elif (num3+num4+num6 == num1+num2+num5):
    print("YES")
elif (num3+num5+num6 == num1+num2+num4):
    print("YES")
elif (num1+num3+num4 == num2+num5+num6):
    print("YES")
elif (num1+num5+num6 == num2+num3+num4):
    print("YES")

else:
    print("NO")

lst = [int(_) for _ in input().split()]

SUM = 0
for i in lst:
    SUM += i

if int(SUM) % 2 == 1:
    print("NO")
    exit()

for a in range(6):
    for b in range(a + 1, 6):
        for c in range(b + 1, 6):
            if a + b + c == SUM / 2:
                print("YES")
                exit()

print("NO")

l=list(map(int,input().split()))
suma=0
sumb=0
for i in l:
    if(suma<=sumb):
        suma+=i
    else:
        sumb+=i
if(suma==sumb):
    print("YES")
else:
    print("NO")

a = list(map(int, input().split()))
print('no' if sum(a) % 2 else 'yes')

forces = [int(i) for i in input().split()]
forces.sort()

if sum(forces) % 2 or sum(forces) // 2 < max(forces):
	print('NO')
else:
	print('YES')

a=list(map(int,input().split()))
a.sort()
a.reverse()
sum1=0
sum2=0
for i in range(len(a)):
    if sum1>sum2 :
        sum2+=a[i]
    else :
        sum1+=a[i]
if sum1==sum2 :
    print('YES')
else :
    print('NO')

def is_partitionable(arr):
	for bitmask in range(2**6):
		num_people = 0
		val = 0
		for pos in range(6):
			bit = bitmask & pos
			if bit == 1:
				val += arr[pos]
				num_people += 1

		if num_people == 3 and 2*val == sum(arr):
			return True

	return False

arr = [int(x) for x in input().split()]

print('YES' if is_partitionable(arr) else 'NO')

def solution(peeps):
	s = sum(peeps)
	for i in range(len(peeps)):
		for j in range(i + 1, len(peeps)):
			for k in range(j + 1, len(peeps)):
				total = i + j + k
				if total == s - total:
					return "YES"
	return "NO"

peeps = list(map(int, input().split()))
print(solution(peeps))

a = [int(i) for i in input().split()]
if sum(a)/2 == 0:
    print('YES')
else:
    print('NO')

a=list(map(int,input().split()))
s=sum(a)
if s%2:
    print("NO")
else:
    s=s/2
    for i in range(4):
        for j in range(i,5):
            for k in range(j,6):
                if a[i]+a[j]+a[k]==s:
                    print("YES")
                    exit(0)
    print("NO")

arr = [1, 3, 2, 1, 2, 1]#list(map(int, input().split()))

def summArr(arr):
	ans = 0
	for i in arr:
		ans += i
	return ans

def NoRun(arr):
	i = 0
	ans = []
	arr1 = set(arr)
	while i < 6:
		if not(i in arr1):
			ans.append(i)
		i+=1
	return ans

def MMain(arr):
	i = 0
	summ1 = 0
	summ2 = 0
	ans = ""
	while i < len(arr):
		j = i + 1
		while j < len(arr):
			k = j + 1
			while k < len(arr):
				NoRun1 = NoRun([i, j, k])
				summ1 = arr[i] + arr[j] + arr[k]
				summ2 = arr[NoRun1[0]] + arr[NoRun1[1]] + arr[NoRun1[2]]
				if summ1 == summ2:
					ans = "YES"
				k+=1
			j+=1
		i+=1

	if len(ans) != 0:
		return ans
	else:
		return "NO"
def main():
	if summArr(arr) % 2 == 0:
		print(MMain(arr))
	else:
		print("NO")

if __name__ == "__main__":
	main()

A,B,C,D,E,F= input("").split()
A=int(A)
B=int(B)
C=int(C)
D=int(D)
E=int(E)
F=int(F)
a1=A+B+C
a2=D+E+F
b1=A+C+D
b2=B+E+F
c1=A+D+E
c2=B+C+F
d1=A+E+F
d2=B+C+D
e1=A+F+B
e2=C+D+E
f1=B+D+F
f2=A+C+E
g1=A+B+E
g2=C+D+F
h1=B+C+E
h2=A+D+F
i1=A+B+D
i2=C+E+F
if a1==a2:
    print("YES")
elif b1==b2:
    print("YES")
elif c1==c2:
    print("YES")
elif d1==d2:
    print("YES")
elif e1==e2:
    print("YES")
elif f1==f2:
    print("YES")
elif g1==g2:
    print("YES")
elif h1==h2:
    print("YES")
elif i1==i2:
    print("YES")
else:
    print("NO")

def ans(inp):
    sm = sum(inp)
    if sm % 2 == 1:
        print("NO")
        return
    for a in range(6):
        for b in range(6):
            for c in range(6):
                if a != b and b != c:
                    s = inp[a] + inp[b] + inp[c]
                    if s*2 == sm :
                        print("YES")
                        return
    print("NO")

inp = input().split(" ")
inp = list(map(int, inp))
ans(inp)

a = list(map(int,input().split()))
s = sum(list(a))
cnt = 0
for m in (a):
    for n in (a):
        for p in (a):
            if (s%2==0) and (m+n+p==s//2): cnt+=1
if (cnt > 0): print("YES")
else: print("NO")

from itertools import combinations

a = list(sorted(map(int, input().split())))
x = list(combinations(a, 3))
z = sum(a) // 2
for i in x:
    if sum(i) == z:
        exit(print('yes'))
print('no')

# Belongs to : midandfeed aka asilentvoice
q = [int(x) for x in input().split()]
q.sort()
print("YES" if sum(q[2:5])*2 == sum(q) else "NO")

#!/usr/bin/python
a=[]
b=[]
c=[]
d=[]
a=[]
for i in raw_input().split():
		a.append(int(i))
a.sort()
b=a[::-1]
sum1=0
sum2=0
for i in range(6):
		if(sum1<=sum2):
				sum1=sum1+b[i]
				c.append(b[i])
				b[i]=0
		elif(sum2<=sum1):
				sum2=sum2+b[i]
				d.append(b[i])
				b[i]=0
if(sum2==sum1):
		print "YES"
else:
		print"NO"

n = 6
arr = [int(x) for x in raw_input().split()]
ans = 0
sum = 0
for i in range(n):
	sum += arr[i]
for i in range(n):
    for j in range(i,n):
	    for k in range(j,n):
		    if(arr[i]+arr[j]+arr[k])<<1 == sum:
			    ans = 1
if ans==1:
    print "YES"
else:
    print "NO"

a = list(map(int, input().split()))
a.sort()
for i in range(len(a)):
  for j in range(i+1, len(a)):
    for k in range(j+1, len(a)):
      if a[i] + a[j] + a[k] == (sum(a)) // 2:
        print('YES')
        exit()
print("NO")

from itertools import combinations
s = combinations(set(map(int, input().split())),3)
sets = []
for s1, s2, s3 in s:
    sets.append(sum((s1, s2, s3)))

for i in range(len(sets)):
    for j in range(i, len(sets)):
        if sets[i] == sets[j]:
            print('YES')
            exit()
print('NO')

num1,num2,num3,num4,num5,num6=input().split()
num1=int(num1)
num2=int(num2)
num3=int(num3)
num4=int(num4)
num5=int(num5)
num6=int(num6)

if (num1+num2+num3 == num4+num5+num6):
    print("YES")
elif (num2+num3+num4 == num1+num5+num6):
    print("YES")
elif (num3+num4+num5 == num1+num2+num6):
    print("YES")
elif (num1+num4+num5 == num2+num3+num6):
    print("YES")
elif (num2+num4+num6 == num1+num3+num5):
    print("YES")
elif (num1+num4+num6 == num2+num3+num5):
    print("YES")
elif (num2+num5+num6 == num1+num3+num4):
    print("YES")
elif (num3+num4+num6 == num1+num2+num5):
    print("YES")
elif (num3+num5+num6 == num1+num2+num4):
    print("YES")
elif (num1+num3+num4 == num2+num5+num6):
    print("YES")
elif (num1+num5+num6 == num2+num3+num4):
    print("YES")
elif (num2+num4+num5 == num1+num3+num6):
    print("YES")
elif (num2+num3+num6 == num1+num4+num5):
    print("YES")

d=list(map(int, input().split()))
s=sum(d)/2
if s%1!=0:
    print("NO")
    exit()
d.sort()
if d[5]+d[0]+d[1]>s:
    print("NO")
    exit()
e=d[5]-d[0]
if e in d[1:5]:
    print("YES")
    exit()
e=d[5]-d[1]
if e in d[2:5]:
    print("YES")
    exit()
e=d[5]-d[2]
if e in d[3:5]:
    print("YES")
    exit()
print("NO")

a=list(map(int,input().split()))
a.sort()
a.reverse()
sum1=0
sum2=0
c1=0
c2=0
for i in range(len(a)):
    if sum1>sum2 :
        sum2+=a[i]
        c2+=1
    else :
        sum1+=a[i]
        c1+=1
if sum1==sum2 and c1==c2:
    print('YES')
else :
    print('NO')

p=[int(i) for i in input().split()]
q=sum(p)/2
output=False
for x1 in range(4):
    for x2 in range(x1,5):
        for x3 in range(x2,6):
            if x1+x2+x3==q:
                output=True
                break
if output==False:
    print('NO')
else:
    print('YES')

a=list(map(int,input().split()))
a.sort()
a.reverse()
sum1=0
sum2=0
for i in range(len(a)):
    if sum1>sum2 :
        sum2+=a[i]
    else :
        sum1+=a[i]
if sum1==sum2 :
    print('YES')
else :
    print('NO')

a = list(int(x) for x in input().split())
s = sum(a)
count = 0
for i in range(6):
    c = 0
    c += a[i]
    for j in range(i + 1, 6):
        c += a[j]
        for k in range(j + 1, 6):
            b = s
            c += a[k]
            b -= c
            # print(b, c)
            if b == c:
                count = 1
                break
        if count == 1:
            break
    if count == 1:
        break
if count == 1:
    print('YES')
else:
    print('NO')

t=list(map(int,input().split()))

t.sort()

p=0
a=sum(t)
for k in range(6):
    for j in range(k+1,7):
        if len(t[k:j])==3:
            if sum(t[k:j])==a-sum(t[k:j]):
                print('YES')
                p+=1
                break
if p==0:
    print('NO')

a = list(map(int,input().split()))
flag = True
for i in range(0,4):
    for g in range(i+1,5):
        for k in range(g+1,6):
            sum1 = a[i] + a[g]
            sum2 = sum(a) - sum1
            if sum1 == sum2:
                flag = False
print("NO" if flag else "YES")

lst = [int(i) for i in input().split()]
if (sum(lst)%2==1):
    print("NO")
else:
    avr = sum(lst)/2
    hasPrint = False
    for a in range(6):
        for b in range(a, 6):
            for c in range(b, 6):
                if lst[a]+lst[b]+lst[c]==avr and not hasPrint:
                    print("YES")
                    hasPrint = True
    if not hasPrint:
        print("No")

from itertools import combinations
s = combinations(set(map(int, input().split())),3)
sets = []
for s1, s2, s3 in s:
    sets.append(sum((s1, s2, s3)))

for i in range(len(sets)):
    for j in range(len(sets)):
        if sets[i] == sets[j]:
            print('YES')
            exit()
print('NO')

arr = list(map(int,input().split()))
s1 = 0
s2 = 0
arr.sort()
s = sum(arr)
fl = False
for i in range(4):
    for g in range(i,5):
        for j in range(g,6):
            if arr[i] + arr[g] + arr[j] == s/2:
                fl = True
if fl:
    print("Yes")
else:
    print("No")

a=list(map(int,input().split()))
a.sort()
a.reverse()
l1=[a[0]]
l2=[a[1]]
for i in range(2,len(a)):
    if(sum(l1)>=sum(l2)):
        l2.append(a[i])
    else:
        l1.append(a[i])
if(len(l1)==len(l2) and sum(l1)==sum(l2)):
    print("YES")
else:
    print("NO")

a = map(int,raw_input().split())
n = 6
s = sum(a)//2
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if a[i]+a[j]+a[k]==s:
        print("YES")
        exit(0)

print("NO")

from sys import stdin, stdout
from itertools import permutations
data = stdin.readline().rstrip().split(' ')
#find sum
total = 0
foundit=False
for i in data:
    i = int(i)
    total += i
if total % 2 == 0:
    triple_pairs = permutations(data,3)
    for pair in triple_pairs:
        pair_l = [int(x) for x in pair]
        pair_sum = pair_l[0]+pair_l[1]+pair_l[2]

        if pair_sum == total/2:
            print('hi')
            stdout.write('YES')
            foundit = True
            break
    if not foundit:
        stdout.write('NO')
else:
    stdout.write('NO')

a = list(map(int,input().split()))
s = sum(list(a))
cnt = 0
for m in (a):
    for n in (a):
        for p in (a):
            if (s%2==0) and (m+n+p==s//2): cnt+=1
if (cnt > 0): print("YES")
else: print("NO")

w = list(map(int, input().split()))
e = 1
for i in range(5):
    for j in range(4):
        if w[1] + w[i] + w[j] == sum(w) / 2:
            e = 1
if e != 1 or max(w) - min(w) > sum(w) - max(w) - min(w):
    print('NO')
else:
    print('YES')