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*<sub class="lower-index">*i*</sub>. 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.
The single line contains six integers *a*<sub class="lower-index">1</sub>, ..., *a*<sub class="lower-index">6</sub> (0 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 1000) — scores of the participants
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.
1 3 2 1 2 1
YES
1 1 1 1 1 99
NO
1000 1000 1000 1000 1000 1000
YES
0 0 0 0 0 0
YES
633 609 369 704 573 416
NO
353 313 327 470 597 31
NO
835 638 673 624 232 266
NO
936 342 19 398 247 874
NO
417 666 978 553 271 488
NO
71 66 124 199 67 147
YES
54 26 0 171 239 12
YES
72 8 186 92 267 69
YES
180 179 188 50 75 214
YES
16 169 110 136 404 277
YES
101 400 9 200 300 10
YES
101 400 200 9 300 10
YES
101 200 400 9 300 10
YES
101 400 200 300 9 10
YES
101 200 400 300 9 10
YES
4 4 4 4 5 4
NO
2 2 2 2 2 1
NO
1000 1000 999 1000 1000 1000
NO
129 1 10 29 8 111
NO
1000 1000 1000 999 999 1000
YES
101 200 300 400 9 10
YES
101 400 200 300 10 9
YES
101 200 400 300 10 9
YES
101 200 300 400 10 9
YES
101 200 300 10 400 9
YES
1 1 1 1 1 5
NO
8 1 1 3 3 0
NO
1 1 2 2 3 3
YES
1 2 2 5 2 5
NO
1 2 3 6 6 6
NO
36 91 7 86 51 89
NO
10 1 1 1 23 24
NO
1 1 1 10 23 24
NO
20 10 1 2 3 44
NO
7 0 14 11 8 6
NO
100 496 1 1 1 1
NO
5 4 2 5 11 3
NO
1 3 7 8 8 9
YES
1 3 4 5 18 19
YES
5 5 1 2 2 15
NO
2 1 0 0 0 5
NO
1 6 6 1 20 2
NO
2 10 0 0 0 0
NO
1 1 3 1 1 11
NO
10 10 1 1 1 37
NO
1 1 0 0 0 4
NO
1 1 10 1 1 28
NO
1 5 5 5 6 8
YES
0 2 3 4 4 5
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")
