In a small but very proud high school it was decided to win ACM ICPC. This goal requires to compose as many teams of three as possible, but since there were only 6 students who wished to participate, the decision was to build exactly two teams.

After practice competition, participant number i got a score of a_{i}. Team score is defined as sum of scores of its participants. High school management is interested if it's possible to build two teams with equal scores. Your task is to answer that question.


-----Input-----

The single line contains six integers a_1, ..., a_6 (0 ≤ a_{i} ≤ 1000) — scores of the participants


-----Output-----

Print "YES" (quotes for clarity), if it is possible to build teams with equal score, and "NO" otherwise.

You can print each character either upper- or lowercase ("YeS" and "yes" are valid when the answer is "YES").


-----Examples-----
Input
1 3 2 1 2 1

Output
YES

Input
1 1 1 1 1 99

Output
NO



-----Note-----

In the first sample, first team can be composed of 1st, 2nd and 6th participant, second — of 3rd, 4th and 5th: team scores are 1 + 3 + 1 = 2 + 1 + 2 = 5.

In the second sample, score of participant number 6 is too high: his team score will be definitely greater.

Difficulty: interview

Starter code:

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


a = list(map(int, input().split()))
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) - a[i] - a[j] - a[k]:
                print("YES")
                return
print("NO")

import itertools
import re
import math
import getpass
import sys

debug = False
files = False
if getpass.getuser() == 'frohe':
    debug = True

if debug and files:
    sys.stdin = open('test.in')


def ria():
    return [int(i) for i in input().split()]


ar = ria()
hf=sum(ar)/2
for i in itertools.combinations(ar,3):
    if sum(i)==hf:
        print('YES')
        return
print('NO')

from itertools import permutations as perms
def main():
    read = lambda: tuple(map(int, input().split()))
    l = read()
    for p in perms(l):
        #print(*p)
        if sum(p[:3]) == sum(p[3:]):
            return "YES"
    return "NO"
print(main())


import sys
t=list(map(int,input().split()))
for i in range(6):
    for j in range(6):
        for m in range(6):
            if i!=m and i!=j and j!=m:
                s=t[i]+t[j]+t[m]
                if(s*2==sum(t)):
                    print('YES')
                    return
print('NO')


lst = list(map(int, input().split()))
sm = sum(lst)
for a in range(len(lst)):
    for b in range(len(lst)):
        for c in range(len(lst)):
            if len(set([a, b, c])) != 3: continue
            q = lst[a] + lst[b] + lst[c]
            if sm - q == q:
                print('YES')
                return

print('NO')


arr = list(map(int, input().split()))
n = 6
sm = sum(arr)
for i in range(n):
    for i1 in range(i):
        for i2 in range(i1):
            if sm - arr[i] - arr[i1] - arr[i2] == arr[i] + arr[i1] + arr[i2]:
                print("YES")
                return
print("NO")

a = [int(i) for i in input().split()]
ans = False
for i in range(65):
    m = bin(i)[2:].zfill(6)
    if m.count('1') == 3:
        q = sum([a[z] for z in range(6) if m[z] == '1'])
        if q * 2 == sum(a):
            ans = True
            break
if ans:
    print('YES')
else:
    print('NO')

a, b, c, d, e, f = list(map(int, input().split()))
if (a + b + c == d + e + f) :
    print('YES')
elif (a + b + d == c + e + f) :
    print('YES')
elif (a + b + e == c + d + f) :
    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 + d + f) :
    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')
    
    


import sys;

#sys.stdin = open("input.txt", "r");
#sys.stdout = open("output.txt", "w");

def ria():
    return [int(x) for x in input().split()];

tf = 0;
a = ria();
n = len(a);
for i in range(n-2):
    for j in range(i+1, n-1, 1):
        for k in range(j+1, n, 1):
            if a[i] + a[j] + a[k] == (sum(a) / 2 ):
                tf = 1;
                break;
        if tf == 1:
            break;
    if tf == 1:
        break;

if ( tf == 1 ):
    print("YES");
else:
    print("NO");


#sys.stdout.close();


l = list(map(int, input().split()))
t = False
for i1 in range(6):
  for i2 in range(i1+1, 6):
    for i3 in range(i2+1, 6):
      if l[i1] + l[i2] + l[i3] == sum(l) - (l[i1] + l[i2] + l[i3]):
        t = True
if t == True:
  print('YES')
else:
  print('NO')

import itertools
A = list(map(int, input().split()))
B = itertools.permutations(A)
ans = False
for i in B:
    if sum(i[:3]) == sum(i[3:]):
        ans = True
        break
if ans:
    print("YES")
else:
    print("NO")

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

n=list(map(int,input().split()))
s=0;b=False
for i in range(6):
    s+=n[i]
for i in range(6):
    for j in range(i+1,6):
        for k in range(j+1,6):
            if n[i]+n[k]+n[j]==s//2:
                b=True
if s%2==1:
    b=False
if b:
    print("YES")
else:
    print('NO')


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

b=False
for i in range(0,4):
    for j in range(i+1,5):
        for k in range(j+1,6):
            if a[i]+a[j]+a[k]==s:
                b=True
print('YES' if b else 'NO')


a = list(map(int, input().split()))
for i in range(1 << 6):
    currsum = 0
    currcnt = 0
    for j in range(6):
        if ((i >> j) & 1) != 0:
            currsum += a[j]
            currcnt += 1
        else:
            currsum -= a[j]
    if currsum == 0 and currcnt == 3:
        print('YES')
        return
print('NO')


a = [int(i) for i in input().split()]
ans = "NO"
for i in range(0, 4):
    for j in range(i + 1, 5):
        for k in range(j + 1, 6):
            sum1 = a[i] + a[j] + a[k]
            sum2 = 0
            for x in range(6):
                if x != i and x != j and x != k:
                    sum2 += a[x]
            if sum1 == sum2:
                ans = "YES"
print(ans)

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

sumA = 0
for i in range(6):
    sumA += a[i]

isPossible = False

for i in range(4):
    for j in range(i + 1, 5):
        for k in range(j + 1, 6):
            sumB = a[i] + a[j] + a[k]

            if sumB * 2 == sumA:
                isPossible = True

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


from itertools import combinations

nums = [int(x) for x in input().split()]
average = sum(nums) / 2
for a, b, c in combinations(nums, 3):
	if a + b + c == average:
		print('YES')
		break
else:
	print('NO')


powers = list(map(int, input().split()))
for first in range(len(powers)):
    for second in range(first+1,len(powers)):
        for third in range(second + 1,len(powers)):
            sum1 = powers[first] + powers[second] + powers[third]
            used = set([first, second, third])
            sum2 = 0
            for i in range(len(powers)):
                if i not in used:
                    sum2 += powers[i]
            if sum1 == sum2:
                print("YES")
                return
print("NO")

from itertools import permutations


mas = [int(i) for i in input().split()]
s = permutations(mas)
for i in s:
    if sum(i[:3]) == sum(i[3:]):
        print("YES")
        return
print("NO")

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 or j == k or i == k:
                pass
            else:
                ts = a[i] + a[j] + a[k]
                if ts == s - ts:
                    print("YES")
                    return

print("NO")


a = list(map(int, input().split()))
p = sum(a)
ans = "NO"
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] == p - (a[i] + a[j] + a[k]):
                ans = "YES"
                break
print(ans)


def main():
    ppl = list(map(int, input().split()))
    strange = sum(ppl)
    if strange % 2 != 0:
        print('NO')
        return
    s1 = strange // 2
    s1 -= ppl[0]
    for i in range(1, 6):
        for k in range(i + 1, 6):
            if ppl[i] + ppl[k] == s1:
                print('YES')
                return
    print('NO')

main()