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.

Source: codeforces | Difficulty: MEDIUM


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


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


inp = list(map(int, input().split(' ')))
out = 'NO'
half = sum(inp) / 2
state = 'NO'
for i in range(1, 5):
	for j in range(i + 1, 6):
		temp = inp[0] + inp[i] + inp[j]
		if temp == half:
			state = 'YES'
print(state)


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')


a = list(map(int, input().split()))
a.sort()
if a[0] + a[1] + a[5] == a[2] + a[3] + a[4] or a[0] + a[1] + a[4] == a[2] + a[3] + a[5] or a[0] + a[1] + a[3] == a[2] + a[5] + a[4] or (a[0] + a[4] + a[5] == a[1] + a[2] + a[3]) or (a[0] + a[3] + a[5] == a[1] + a[2] + a[4]) or (a[0] + a[4] + a[3] == a[1] + a[2] + a[5]) or (a[0] + a[2] + a[3] == a[1] + a[4] + a[5]) or (a[0] + a[2] + a[4] == a[1] + a[3] + a[5]) or (a[0] + a[2] + a[5] == a[1] + a[4] + a[3]):
	print('YES')
else:
	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')


mas = list(map(int, input().split()))
set1 = {0, 1, 2, 3, 4, 5}
ans = 'NO'
for i in set1:
	for j in set1:
		for k in set1:
			if i == j or i == k or j == k:
				continue
			sum1 = 0
			sum2 = 0
			set2 = {i, j, k}
			for g in set1 - set2:
				sum1 += mas[g]
			for h in set2:
				sum2 += mas[h]
			if sum1 == sum2:
				ans = 'YES'
print(ans)


a = [int(x) for x in input().split()]
s = sum(a)
f = False
for i in range(6):
	for j in range(6):
		for k in range(6):
			if i == j or j == k or i == k:
				continue
			f |= a[i] + a[j] + a[k] == s - (a[i] + a[j] + a[k])
if f:
	print('YES')
else:
	print('NO')


(a, b, c, d, e, f) = map(int, input().split())
res = a + b + c + d + e + f
if res % 2 == 1:
	print('NO')
else:
	res //= 2
	if a + b + c == res or a + b + d == res or a + b + e == res or (a + b + f == res) or (a + c + d == res) or (a + c + e == res) or (a + c + f == res) or (a + d + e == res) or (a + d + f == res) or (a + e + f == res) or (b + c + d == res) or (b + c + e == res) or (b + c + f == res) or (b + d + e == res) or (b + d + f == res) or (b + e + f == res) or (c + d + e == res) or (c + d + f == res) or (c + e + f == res) or (d + e + f == res):
		print('YES')
	else:
		print('NO')


a = input().split()
for i in range(6):
	a[i] = int(a[i])
s = sum(a)
flag = False
for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			if 2 * (a[i] + a[j] + a[k]) == s:
				flag = True
if flag:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
x = 0
for i in range(5):
	for j in range(5):
		if i != j:
			if a[i] + a[j] + a[5] == sum(a) - a[j] - a[i] - a[5]:
				x = 1
				break
if x == 1:
	print('YES')
else:
	print('NO')


import itertools
arr = list(map(int, input().split()))
rn = range(6)

def othersIters(arr):
	_arr = set(rn)
	return list(_arr.symmetric_difference(arr))
t = False
for i in list(itertools.combinations(rn, 3)):
	summ1 = sum((arr[j] for j in i))
	summ2 = sum((arr[j] for j in othersIters(i)))
	if summ1 == summ2:
		t = True
		break
if t:
	print('YES')
else:
	print('NO')


(a, b, c, d, e, f) = map(int, input().split())
if a + b + c == d + e + f:
	print('yes')
	exit(0)
if a + b + d == c + e + f:
	print('yes')
	exit(0)
if a + b + e == d + c + f:
	print('yes')
	exit(0)
if a + b + f == d + e + c:
	print('yes')
	exit(0)
if a + d + c == b + e + f:
	print('yes')
	exit(0)
if a + e + c == d + b + f:
	print('yes')
	exit(0)
if a + f + c == d + e + b:
	print('yes')
	exit(0)
if a + d + e == b + c + f:
	print('yes')
	exit(0)
if a + d + f == b + c + e:
	print('yes')
	exit(0)
if a + e + f == b + c + d:
	print('yes')
	exit(0)
print('no')


list1 = list(map(int, input().split()))
a = 0
for i in range(6):
	a += list1[i]
flag = False
for i in range(6):
	if flag:
		break
	for j in range(6):
		for q in range(6):
			if flag:
				break
			if i != j and i != q and (q != j):
				if list1[i] + list1[j] + list1[q] == a - list1[i] - list1[j] - list1[q]:
					print('YES')
					flag = True
					break
if not flag:
	print('NO')


a = [int(x) for x in input().split()]
fl = False
for i in range(6):
	for j in range(6):
		for k in range(6):
			if i == j or k == j or i == k:
				continue
			if a[i] + a[j] + a[k] == sum(a) / 2 and sum(a) % 2 == 0:
				fl = True
if fl:
	print('YES')
else:
	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')
				exit(0)
print('NO')


a = list(map(int, input().split()))
s = 0
for i in a:
	s += i
i = 0
j = 1
z = 2
test = True
while i < 4 and test:
	while j < 5 and test:
		while z < 6 and test:
			if a[i] + a[j] + a[z] == s - a[i] - a[j] - a[z]:
				test = False
			z += 1
		j += 1
		z = j + 1
	i += 1
	j = i + 1
	z = i + 2
if not test:
	print('YES')
else:
	print('NO')


def wrapper():
	a = [int(x) for x in input().split()]
	for i in range(6):
		for j in range(6):
			if i == j:
				continue
			for k in range(6):
				if i == k or j == k:
					continue
				c = list(range(6))
				c.remove(i)
				c.remove(j)
				c.remove(k)
				if a[i] + a[k] + a[j] == a[c[0]] + a[c[1]] + a[c[2]]:
					print('YES')
					return
	print('NO')
wrapper()


from sys import stdin as fin
arr = list(map(int, fin.readline().split()))
s = sum(arr)
flag = False
for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			if s == 2 * (arr[i] + arr[j] + arr[k]) and (not flag):
				print('YES')
				flag = True
if not flag:
	print('NO')


g = input().split()
M = list(map(int, g))
count = S = 0
while count < 6:
	S = S + M[count]
	count += 1
if S % 2 != 0:
	print('NO')
else:
	S = S // 2
	a = 1
	O = 0
	while a < 5:
		b = a
		while b != 5:
			b += 1
			if M[0] + M[a] + M[b] == S:
				O = 1
				print('YES')
				break
		if M[0] + M[a] + M[b] == S:
			break
		a += 1
	if O == 0:
		print('NO')


numbers = [int(i) for i in input().split()]
total = sum(numbers)
flag = False
for x in range(4):
	for y in range(x + 1, 5):
		for z in range(y + 1, 6):
			if numbers[x] + numbers[y] + numbers[z] == total / 2:
				flag = True
				break
		if flag == True:
			break
	if flag == True:
		break
if flag:
	print('YES')
else:
	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')
		exit()
print('NO')


import sys
import math
import bisect

def solve(A):
	n = 6
	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 == sum(A):
					return True
	return False

def main():
	A = list(map(int, input().split()))
	if solve(A):
		print('YES')
	else:
		print('NO')
main()


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 = list(map(int, input().split()))
for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			s1 = a[i] + a[j] + a[k]
			s2 = 0
			for t in range(6):
				if t != i and t != j and (t != k):
					s2 += a[t]
			if s1 == s2:
				print('YES')
				exit()
			s2 = 0
print('NO')


nums = sorted([int(j) for j in input().split()])
output = 'NO'
for j in range(6):
	for k in range(6):
		if k != j:
			for l in range(6):
				if l != k and l != j:
					s = nums[j] + nums[k] + nums[l]
					if s == sum(nums) - s:
						output = 'YES'
print(output)


m = input().split()
n = 1
sum = 0
while n < len(m):
	for i in range(len(m) - n):
		if m[i] > m[i + 1]:
			(m[i], m[i + 1]) = (m[i + 1], m[i])
	n += 1
if int(max(m)) + int(m[0]) + int(m[1]) == int(m[2]) + int(m[3]) + int(m[4]):
	print('YES')
elif int(max(m)) + int(m[2]) + int(m[1]) == int(m[0]) + int(m[3]) + int(m[4]):
	print('YES')
elif int(max(m)) + int(m[2]) + int(m[0]) == int(m[1]) + int(m[3]) + int(m[4]):
	print('YES')
elif int(max(m)) + int(m[3]) + int(m[0]) == int(m[2]) + int(m[1]) + int(m[4]):
	print('YES')
elif int(max(m)) + int(m[3]) + int(m[1]) == int(m[0]) + int(m[2]) + int(m[4]):
	print('YES')
elif int(max(m)) + int(m[2]) + int(m[3]) == int(m[0]) + int(m[1]) + int(m[4]):
	print('YES')
elif int(max(m)) + int(m[4]) + int(m[0]) == int(m[1]) + int(m[3]) + int(m[2]):
	print('YES')
elif int(max(m)) + int(m[4]) + int(m[1]) == int(m[0]) + int(m[3]) + int(m[2]):
	print('YES')
elif int(max(m)) + int(m[2]) + int(m[4]) == int(m[0]) + int(m[3]) + int(m[1]):
	print('YES')
elif int(max(m)) + int(m[4]) + int(m[3]) == int(m[0]) + int(m[1]) + int(m[2]):
	print('YES')
else:
	print('NO')


from itertools import *
a = [int(x) for x in input().split()]
s1 = 0
s2 = 0
flag = 0
for o in permutations(a):
	s1 = o[0] + o[1] + o[2]
	s2 = o[3] + o[4] + o[5]
	if s1 == s2:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


baris = input()
string = baris.split(' ')
a = []
for i in range(0, 6):
	a.append(int(string[i]))
	cekAkhir = False
for i in range(0, 6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			cek1 = a[i] + a[j] + a[k]
			cek2 = 0
			for z in range(0, 6):
				if z != i and z != j and (z != k):
					cek2 = cek2 + a[z]
			if cek1 == cek2:
				cekAkhir = True
if cekAkhir:
	print('YES')
else:
	print('NO')


from itertools import combinations
A = list(map(int, input().split()))
x = sum(A) / 2
print('YES' if any((sum(team) == x for team in combinations(A, 3))) else 'NO')


from itertools import permutations
powers = list(map(int, input().split()))

def get_powers(indexes):
	return [powers[i] for i in indexes]

def main():
	for combination in permutations(range(6)):
		if sum(get_powers(combination[:3])) == sum(get_powers(combination[3:])):
			return 'YES'
	return 'NO'
print(main())


from itertools import permutations

def isRight(arr):
	n = len(arr)
	x = y = 0
	for i in range(n // 2):
		x += arr[i]
		y += arr[n - i - 1]
	if x == y:
		return True
	return False
arr = list(map(int, input().split()))
f = 1
permutation = permutations(arr)
for perm in list(permutation):
	if isRight(perm):
		print('YES')
		f = 0
		break
if f:
	print('NO')


a = list(map(int, input().split()))
s = sum(a)
flag = 0
for i in range(0, 6):
	for j in range(i + 1, 6):
		for x in range(j + 1, 6):
			if (a[i] + a[j] + a[x]) * 2 == s:
				flag = 1
if flag == 1:
	print('YES')
else:
	print('NO')


a = [int(x) for x in input().split()]
s = False
if a[0] + a[1] + a[2] == a[3] + a[4] + a[5]:
	s = True
if a[0] + a[1] + a[3] == a[2] + a[4] + a[5]:
	s = True
if a[0] + a[1] + a[4] == a[3] + a[2] + a[5]:
	s = True
if a[0] + a[1] + a[5] == a[3] + a[4] + a[2]:
	s = True
if a[0] + a[3] + a[2] == a[1] + a[4] + a[5]:
	s = True
if a[0] + a[4] + a[2] == a[3] + a[1] + a[5]:
	s = True
if a[0] + a[5] + a[2] == a[3] + a[4] + a[1]:
	s = True
if a[0] + a[3] + a[4] == a[1] + a[2] + a[5]:
	s = True
if a[0] + a[3] + a[5] == a[1] + a[4] + a[2]:
	s = True
if a[0] + a[4] + a[5] == a[3] + a[1] + a[2]:
	s = True
if s:
	print('YES')
else:
	print('NO')


studs = [int(x) for x in input().split(' ')]
import itertools

def main():
	for perm in itertools.permutations([x for x in range(6)]):
		sum1 = studs[perm[0]] + studs[perm[1]] + studs[perm[2]]
		sum2 = studs[perm[3]] + studs[perm[4]] + studs[perm[5]]
		if sum1 == sum2:
			print('YES')
			return True
if not main():
	print('NO')


a = [g for g in map(int, input().split(' '))]
can = False
for i in range(4):
	if not can:
		for j in range(i + 1, 5):
			if not can:
				for k in range(j + 1, 6):
					r = [l for l in range(6)]
					r.remove(i)
					r.remove(j)
					r.remove(k)
					if a[i] + a[j] + a[k] == a[r[0]] + a[r[1]] + a[r[2]]:
						can = True
						break
if can:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
s = sum(a)
YES = False
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]) * 2 == s:
				YES = True
if YES:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
b = a[0] + a[1] + a[2] + a[3] + a[4] + a[5]
y = 0
t = 0
for i in range(6):
	for j in range(6 - abs(i - 6) + 1, 6):
		for k in range(6 - abs(j - 6) + 1, 6):
			if a[i] + a[j] + a[k] == b // 2 and b % 2 == 0:
				print('YES')
				y += 1
				break
		if y > 0:
			break
	if y > 0:
		break
else:
	print('NO')


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

def f():
	for i in range(0, 6):
		for j in range(0, 6):
			for h in range(0, 6):
				if i != j and j != h and (i != h):
					if a[i] + a[j] + a[h] == s / 2:
						return 'YES'
	return 'NO'
print(f())


arr = list(map(int, input().split()))
for i in range(7, 1 << 6):
	ans = 0
	cnt = 0
	for j in range(6):
		if 1 << j & i:
			cnt += 1
			ans += arr[j]
		else:
			ans -= arr[j]
	if not ans and cnt == 3:
		print('YES')
		exit(0)
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)


from itertools import permutations
a = list(map(int, input().split()))
flag = False
for b in permutations(a):
	if sum(b[:3]) == sum(b[3:]):
		flag = True
		break
	if flag:
		break
if flag:
	print('YES')
else:
	print('NO')


from itertools import combinations
array = list(map(int, input().split()))
summa = sum(array)
if summa % 2 != 0:
	print('NO')
	exit()
cs = combinations(array, 3)
for c in cs:
	if summa - sum(c) == summa // 2:
		print('YES')
		exit()
print('NO')


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')
				exit()
print('NO')


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


from itertools import permutations
a = list(map(int, input().split()))
for x in permutations(tuple(a), 6):
	if sum(x[:3]) == sum(x[3:6]):
		print('YES')
		break
else:
	print('NO')


people = input().split(' ')
people = list(map(int, people))
y = 0
needed = (people[0] + people[1] + people[2] + people[3] + people[4] + people[5]) / 2
if round(needed) == needed:
	for a in range(6):
		for b in range(a + 1, 6):
			for c in range(b + 1, 6):
				if people[a] + people[b] + people[c] == needed:
					y = 1
if y:
	print('YES')
else:
	print('NO')


from sys import stdin
A = list(map(int, stdin.readline().split()))
s = sum(A)
if s % 2 != 0:
	print('NO')
	exit(0)
flag = 0
for p in range(4):
	for j in range(5):
		for k in range(6):
			if p == j or p == k or j == k:
				continue
			if A[p] + A[j] + A[k] == s // 2:
				flag = 1
				break
		if flag == 1:
			break
	if flag == 1:
		break
if flag:
	print('YES')
else:
	print('NO')


import itertools
a = list(map(int, input().split()))
R = [0, 1, 2, 3, 4, 5]
flag = False
for (i, j, k) in itertools.combinations(R, 3):
	sum1 = a[i] + a[j] + a[k]
	sum2 = 0
	for l in range(6):
		if l != i and l != j and (l != k):
			sum2 += a[l]
	if sum1 == sum2:
		flag = True
if flag:
	print('YES')
else:
	print('NO')


A = list(map(int, input().split()))
B = []
k = sum(A)

def Danila():
	for i in range(4):
		for j in range(i + 1, 5):
			for l in range(j + 1, 6):
				if 2 * (A[i] + A[j] + A[l]) == k:
					return 'YES'
	return 'NO'
if k % 2 != 0:
	print('NO')
else:
	print(Danila())


def foo():
	sila = list(map(lambda x: int(x), input().split()))
	kom1 = []
	players = [0, 0, 0]
	for i in range(6):
		sila2 = sila[:]
		players[0] = sila2.pop(i)
		for z in range(5):
			sila3 = sila2[:]
			players[1] = sila3.pop(z)
			for b in range(3):
				sila4 = sila3[:]
				players[2] = sila4.pop(b)
				if sum(sila4) == sum(players):
					return 'YES'
	return 'NO'
print(foo())


a = list(map(int, input().split()))
s = sum(a)
flag = False
for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			s2 = a[i] + a[j] + a[k]
			if s - s2 == s2:
				flag = True
if flag:
	print('YES')
else:
	print('NO')


temp = [int(i) for i in input().split(' ')]
gobal = sum(temp) / 2
flags = 0
for i in range(len(temp)):
	for j in range(i + 1, len(temp)):
		for z in range(j + 1, len(temp)):
			if sum([temp[i], temp[j], temp[z]]) == gobal and (not flags):
				flags = 1
				break
print('Yes' if flags else 'No')


import itertools
a = [int(x) for x in input().split()]
index = list(range(6))
b = list(itertools.combinations(index, 3))
c = len(b)
for z in range(c):
	for x in range(z + 1, c):
		if not any([y in b[x] for y in b[z]]):
			if sum((a[y] for y in b[z])) == sum((a[y] for y in b[x])):
				print('yes')
				quit()
print('no')


import sys
l = [int(el) for el in input().split()]
s = set()
for a in range(6):
	for b in range(6):
		for c in range(6):
			for d in range(6):
				for e in range(6):
					for f in range(6):
						s.add(a)
						s.add(b)
						s.add(c)
						s.add(d)
						s.add(e)
						s.add(f)
						if len(s) == 6:
							if l[a] + l[b] + l[c] == l[e] + l[d] + l[f]:
								print('YES')
								sys.exit(0)
						s.clear()
print('NO')


string = input()
array = string.split(' ')
forces = list()
for i in array:
	forces.append(int(i))
mean = sum(forces) / 2
finished = False
if int(mean) == mean:
	for i in range(4):
		for j in range(5):
			for k in range(6):
				if i != j and j != k and (k != i):
					if forces[i] + forces[j] + forces[k] == mean:
						print('YES')
						finished = True
						break
			if finished:
				break
		if finished:
			break
	if not finished:
		print('NO')
else:
	print('NO')


(a, b, t, c) = (input(), 0, '', [])
for x in a:
	if x != ' ':
		t += x
	else:
		c += [int(t)]
		t = ''
c += [int(t)]
for x in c:
	b += x
for x in c:
	if x > b // 2 or b % 2 == 1:
		print('NO')
		exit()
for (x, y, z) in [[3, 2, 1], [4, 2, 1], [5, 2, 1], [6, 2, 1], [4, 3, 1], [5, 3, 1], [6, 3, 1], [5, 4, 1], [6, 4, 1], [6, 5, 1], [4, 3, 2], [5, 3, 2], [6, 3, 2], [5, 4, 2], [6, 4, 2], [6, 5, 2], [5, 4, 3], [6, 4, 3], [6, 5, 3], [6, 5, 4]]:
	if c[-x] + c[-y] + c[-z] == b // 2:
		print('YES')
		exit()
print('NO')


def main():
	a = list(map(int, input().split()))
	s = sum(a)
	if s % 2 == 0:
		for i in range(6):
			for j in range(6):
				if j != i:
					for k in range(6):
						if k != i and k != j:
							if a[i] + a[j] + a[k] == s // 2:
								return 1
	return 0
if main():
	print('YES')
else:
	print('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')


a = list(map(int, input().split()))
s = sum(a)
for i in range(1, 5):
	for j in range(i + 1, 6):
		x = a[0] + a[i] + a[j]
		if x == s - x:
			print('YES')
			exit()
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')


def f(cnt, k, su):
	global r
	if cnt == 3 and r == 2 * su:
		print('YES')
		exit()
		return
	for i in range(k, len(a)):
		if cnt < 3:
			f(cnt + 1, i + 1, su + a[i])
a = list(map(int, input().split()))
a.sort()
r = sum(a)
f(0, 0, 0)
print('NO')


a = list(map(int, input().split()))
f = False
for i in range(6):
	for j in range(6):
		for q in range(6):
			for w in range(6):
				for e in range(6):
					for r in range(6):
						if i != j and i != q and (i != w) and (i != e) and (i != r) and (j != w) and (q != j) and (j != e) and (j != r) and (q != w) and (e != q) and (q != r) and (w != e) and (w != r) and (e != r):
							if a[i] + a[j] + a[q] == a[w] + a[e] + a[r]:
								f = True
if f:
	print('YES')
else:
	print('NO')


from functools import reduce
L = list(map(int, input().split()))
L.sort()
s = reduce(lambda x, y: x + y, L)
if s % 2 != 0:
	print('NO')
else:
	count = 0
	for i in range(0, 6):
		for j in range(0, i):
			for k in range(0, j):
				if L[i] + L[j] + L[k] == s // 2:
					count += 1
	if count >= 2:
		print('YES')
	else:
		print('NO')


a = list(map(int, input().split()))
sm = sum(a)
if sm % 2:
	print('No')
else:
	print(['No', 'Yes'][any((a[i] + a[j] + a[k] == sm / 2 for i in range(4) for j in range(i + 1, 5) for k in range(j + 1, 6)))])


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')
main()


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()))
s = sum(a)
k = 0
if s % 2 == 1:
	print('NO')
else:
	t = s // 2
	k = 0
	for i in range(1, 6):
		for j in range(i + 1, 6):
			if a[i] + a[j] + a[0] == t:
				k = 1
	if k == 1:
		print('YES')
	else:
		print('NO')


arr = list(map(int, input().split()))
s = 0
a = False
for i in arr:
	s += i
if s % 2 == 0:
	for i in range(len(arr)):
		arr1 = arr[0:i] + arr[i + 1:len(arr)]
		for j in range(len(arr1)):
			if s / 2 - arr[i] - arr1[j] in arr1[0:j] + arr1[j + 1:-1]:
				print('YES')
				a = True
				break
		if a:
			break
	if a == False:
		print('NO')
else:
	print('NO')


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


num = list(map(int, input().split()))
sum1 = 0
flag = False
for i in range(len(num)):
	sum1 += num[i]
for i in range(len(num)):
	for j in range(len(num)):
		for q in range(len(num)):
			if i != j and j != q and (i != q):
				a = num[i] + num[j] + num[q]
				if a == sum1 - a:
					flag = True
					break
if flag:
	print('YES')
else:
	print('NO')


(a, b, c, d, e, f) = 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')


mas = list(map(int, input().split()))
for a in range(4):
	for b in range(a + 1, 5):
		for c in range(b + 1, 6):
			if sum(mas) / 2 - (mas[a] + mas[b] + mas[c]) == 0:
				print('YES')
				exit(0)
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')
		exit(0)
print('NO')


l = [int(x) for x in input().split()]
sm = sum(l)
for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			sum3 = l[i] + l[j] + l[k]
			if sm - sum3 == sum3:
				print('YES')
				exit()
print('NO')


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')


a = [int(i) for i in input().split()]
f = 0
for i in range(6):
	if f == 1:
		break
	for j in range(6):
		if f == 1:
			break
		if j != i:
			for k in range(6):
				if k != i and k != j:
					r1 = a[i] + a[j] + a[k]
					b = []
					for q in range(6):
						b.append(a[q])
					b.remove(a[i])
					b.remove(a[j])
					b.remove(a[k])
					r2 = sum(b)
					if r2 == r1:
						f = 1
						print('YES')
						break
if f == 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 = [int(i) for i in input().split()]
s = sum(a)
if s % 2 == 0:
	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')


S = list(map(int, input().split()))
for i1 in range(len(S)):
	for i2 in range(len(S)):
		for i3 in range(len(S)):
			for i4 in range(len(S)):
				for i5 in range(len(S)):
					for i6 in range(len(S)):
						if i1 != i2 and i1 != i3 and (i1 != i4) and (i1 != i5) and (i1 != i6):
							if i2 != i3 and i2 != i4 and (i2 != i5) and (i2 != i6):
								if i3 != i4 and i3 != i5 and (i3 != i6):
									if i4 != i5 and i4 != i6:
										if i5 != i6:
											if S[i1] + S[i2] + S[i3] == S[i4] + S[i5] + S[i6]:
												print('YES')
												exit()
print('NO')


a = [int(x) for x in input().split()]
s = sum(a)
for i in range(6):
	for i1 in range(i + 1, 6):
		for i2 in range(i1 + 1, 6):
			if 2 * (a[i] + a[i1] + a[i2]) == s:
				print('YES')
				exit(0)
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 and j != k and (i != k):
				s1 = a[i] + a[j] + a[k]
				if s - s1 * 2 == 0:
					print('YES')
					exit()
print('NO')


def solution():
	first_team = [0]
	second_team = []
	for i in range(1, len(powers) - 1):
		first_team.append(i)
		for j in range(i + 1, len(powers)):
			first_team.append(j)
			for l in range(1, len(powers)):
				if l not in first_team:
					second_team.append(l)
			f_sum = powers[first_team[0]] + powers[first_team[1]] + powers[first_team[2]]
			s_sum = powers[second_team[0]] + powers[second_team[1]] + powers[second_team[2]]
			if f_sum == s_sum:
				return True
			first_team.pop()
			second_team = []
		first_team = [0]
	return False
powers = list(map(int, input().split()))
nums = list(range(len(powers)))
print('YES') if solution() else print('NO')


t = False
s = list(map(int, input().split()))
if sum(s) % 2 != 0:
	t = False
else:
	for i in range(6):
		for j in range(i + 1, 6):
			for r in range(j + 1, 6):
				if s[i] + s[j] + s[r] == sum(s) // 2:
					t = True
if t:
	print('YES')
else:
	print('NO')


s = sorted(list(map(int, input().split())))
m = []
F = False
(i, z, q, x, c, v) = (0, 0, 0, 0, 0, 0)
while True:
	if i != z and i != q and (i != x) and (i != c) and (i != v) and (z != q) and (z != x) and (z != c) and (z != v) and (q != x) and (q != v) and (q != c) and (x != c) and (x != v) and (c != v):
		if s[i] + s[q] + s[z] == s[x] + s[c] + s[v]:
			F = True
			break
	q += 1
	if q == 6:
		q = 0
		z += 1
		if z == 6:
			i += 1
			z = 0
			if i == 6:
				x += 1
				i = 0
				if x == 6:
					x = 0
					c += 1
					if c == 6:
						c = 0
						v += 1
						if v == 6:
							break
if F == True:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
if sum(a) % 2 == 1:
	print('NO')
	exit()
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')
				exit()
print('NO')


from itertools import permutations
n = list(map(int, input().split()))
k = 0
c = permutations(n)
for i in c:
	w = i[:len(i) // 2]
	v = i[len(i) // 2:]
	if sum(w) == sum(v):
		k = k + 1
		break
if k > 0:
	print('YES')
else:
	print('NO')


n = list(map(int, input().split()))
n.sort()
s = sum(n)
if s < 2 * (n[5] + n[1] + n[0]) or s % 2 != 0 or 2 * (n[5] + n[0]) > s:
	print('NO')
elif n[5] + n[4] + n[0] == s // 2 or n[5] + n[3] + n[1] == s // 2 or n[5] + n[3] + n[0] == s // 2 or (n[5] + n[2] + n[1] == s // 2) or (n[5] + n[2] + n[0] == s // 2) or (n[5] + n[1] + n[0] == s // 2):
	print('YES')
else:
	print('NO')


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


s = [0, 1, 2, 3, 4, 5]
d = []
a = list(map(int, input().split()))
isPossible = False
for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			d = []
			for c in range(6):
				if i != c and j != c and (k != c):
					d.append(c)
			if a[i] + a[j] + a[k] == a[d[0]] + a[d[1]] + a[d[2]]:
				isPossible = True
if isPossible:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
summ = sum(a)
res = 'NO'
if summ % 2 != 1:
	summ //= 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] == summ:
					res = 'YES'
print(res)


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 + 1, 5):
		for j in range(g + 1, 6):
			if arr[i] + arr[g] + arr[j] == s / 2:
				fl = True
if fl:
	print('Yes')
else:
	print('No')


import itertools
lst = map(int, input().split())
for perm in itertools.permutations(lst):
	if sum(perm[:3]) == sum(perm[3:]):
		print('YES')
		break
else:
	print('NO')


s = sorted([int(i) for i in input().split()])
res = False
summ = sum(s)
for i in range(6):
	for j in range(6):
		if j == i:
			continue
		for k in range(6):
			if k == j or k == i:
				continue
			if s[i] + s[j] + s[k] == summ // 2:
				res = True
				break
if summ % 2 == 1:
	res = False
if res:
	print('YES')
else:
	print('NO')


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)


k = list(map(int, input().split()))
m = len(k)
mas1 = []
mas2 = []
mass = []
z = 0
q = 0
for a in range(m):
	for b in range(m):
		for c in range(m):
			for d in range(m):
				for e in range(m):
					for f in range(m):
						mass = [a, b, c, d, e, f]
						for x in range(len(mass)):
							for y in range(len(mass)):
								if x != y and mass[x] == mass[y]:
									q = 1
						if k[a] + k[b] + k[c] == k[d] + k[e] + k[f] and q == 0 and (z == 0):
							z = 1
					q = 0
if z == 0:
	print('NO')
else:
	print('YES')


import itertools
import math
l = list(map(int, input().split()))
p = []
t = [0, 1, 2, 3, 4, 5]
for n in itertools.combinations(range(len(l)), 3):
	tt = []
	xx = []
	for x in n:
		xx.append(l[x])
	tt.append(xx)
	pp = []
	for nn in t:
		if nn not in n:
			pp.append(l[nn])
	tt.append(pp)
	p.append(tt)
for (num, num1) in p:
	if sum(num) == sum(num1):
		print('YES')
		break
else:
	print('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')
		exit(0)
print('NO')


a = list(map(int, input().split()))
if sum(a) % 2 != 0:
	print('NO')
else:
	m = sum(a) // 2
	ok = False
	for i in range(6):
		for j in range(6):
			for k in range(6):
				if i != j and i != k and (j != k) and (a[i] + a[j] + a[k] == m):
					ok = True
	if ok:
		print('YES')
	else:
		print('NO')


def equal_team(score):
	total = sum(score)
	for i in range(len(score) - 2):
		for j in range(i + 1, len(score) - 1):
			for k in range(j + 1, len(score)):
				t1 = score[i] + score[j] + score[k]
				t2 = total - t1
				if t1 == t2:
					return 'YES'
	return 'NO'
score = list(map(int, input().split()))
print(equal_team(score))


lst = list(map(int, input().split()))
sm = sum(lst)
from sys import exit
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')
				exit()
print('NO')


a = (*map(int, input().split()),)
s = sum(a)
print('YNEOS'[s % 2 or all((a[i] + a[j] + a[k] != s // 2 for i in range(6) for j in range(i + 1, 6) for k in range(j + 1, 6)))::2])


n = 6
a = [int(n) for n in input().split()]
c = sum(a)
count = 0
l = a[0]
d = 0
x = 0
for i in range(4):
	l = a[i]
	for m in range(i + 1, len(a) - 1):
		d = a[m]
		for j in range(m + 1, len(a)):
			x = l + d + a[j]
			if x == c - x:
				count += 1
if count > 0:
	print('YES')
else:
	print('NO')


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


s = list(map(int, input().split()))
result = 'NO'
for i in range(len(s)):
	for ix in range(len(s)):
		if i != ix:
			for iy in range(len(s)):
				if ix != iy and iy != i:
					for iz in range(len(s)):
						if iz != iy and iz != ix and (iz != i):
							for ia in range(len(s)):
								if ia != iz and ia != iy and (ia != ix) and (ia != i):
									for ib in range(len(s)):
										if ib != ia and ib != iz and (ib != iy) and (ib != ix) and (ib != i):
											if s[i] + s[ix] + s[iy] == s[iz] + s[ia] + s[ib]:
												result = 'YES'
												break
print(result)


def generate(n, st):
	global count
	global tmp
	ans1 = 0
	ans2 = 0
	if n == 0:
		for i in range(len(st)):
			if st[i] == '1':
				ans1 += A[i]
			else:
				ans2 += A[i]
		if ans1 == ans2 and st.count('1') == 3 and (tmp == 0):
			print('YES')
			tmp = 1
		else:
			count += 1
	else:
		generate(n - 1, st + '1')
		generate(n - 1, st + '0')
count = 0
tmp = 0
A = list(map(int, input().split()))
generate(6, '')
if tmp == 0:
	print('NO')


a = [int(i) for i in input().split()]
a = sorted(a)
d = sum(a)
flag = 0
for i in range(0, len(a) - 2):
	for j in range(i + 1, len(a) - 1):
		for k in range(j + 1, len(a)):
			if a[i] + a[j] + a[k] == d - (a[i] + a[j] + a[k]):
				flag = 1
				break
if flag == 0:
	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')


import sys
MOD = 1000000007

def inp():
	return sys.stdin.readline().strip()

def ii():
	return int(inp())

def iis():
	return [int(i) for i in inp().split()]

def solve():
	a = iis()
	i1 = 0
	s1 = a[i1]
	for (i2, s2) in enumerate(a):
		if i2 != i1:
			for (i3, s3) in enumerate(a):
				if i3 != i2 and i3 != i1:
					team1_score = s1 + s2 + s3
					team2_score = sum([s for (i, s) in enumerate(a) if i != 0 and i != i2 and (i != i3)])
					if team1_score == team2_score:
						return True
	return False
print('YES' if solve() else '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')


a = list(map(int, input().strip().split()))
flag = False
for i in range(6):
	for j in range(6):
		if j == i:
			continue
		for h in range(6):
			if h == j or h == i:
				continue
			an1 = a[i] + a[j] + a[h]
			an2 = sum(a) - an1
			if an2 == an1:
				flag = True
				break
		if flag:
			break
	if flag:
		print('YES')
		break
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)


import sys

def sumOthers(a, first):
	sum = 0
	for i in range(6):
		if first.count(i) == 0:
			sum += a[i]
	return sum
a = [int(x) for x in input().split()]
for i in range(1, 6):
	first = [0]
	first.append(i)
	for j in range(i + 1, 6):
		first.append(j)
		sumFirst = a[0] + a[i] + a[j]
		sumSecond = sumOthers(a, [0, i, j])
		if sumFirst == sumSecond:
			print('YES')
			sys.exit()
print('NO')


import itertools
a = list(map(int, input().split()))
for i in itertools.permutations(a):
	if sum(i[3:]) == sum(i[:3]):
		print('YES')
		exit()
print('NO')


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')


c = [int(i) for i in input().split()]
a = [0, 0, 0, 0, 0, 0]
sum1 = 0
sum2 = 0
for i in range(6):
	for b in range(i + 1, 6):
		for v in range(b + 1, 6):
			a[i] = 1
			a[b] = 1
			a[v] = 1
			sum1 = c[i] + c[v] + c[b]
			for d in range(6):
				if not a[d]:
					sum2 += c[d]
			if sum1 == sum2:
				print('Yes')
				exit()
			else:
				a[i] = 0
				a[b] = 0
				a[v] = 0
			sum2 = 0
print('No')


inp = list(map(int, input().split()))
sinp = sorted(inp, reverse=True)

def main():
	if sum(inp) % 2 == 1:
		print('NO')
		return
	for i in range(6):
		for j in range(6):
			for jj in range(6):
				if i != j and j != jj and (i != jj):
					if sum(inp) - (sinp[i] + sinp[j] + sinp[jj]) == sum(inp) // 2:
						print('YES')
						return
						print('NO')
	print('NO')
main()


s = input().split()
g = 0
m = ''
for a in range(len(s)):
	s[a] = int(s[a])
sum = s[0] + s[1] + s[2] + s[3] + s[4] + s[5]
for a in range(len(s)):
	for b in range(a + 1, len(s)):
		for c in range(b + 1, len(s)):
			if sum == 2 * (s[a] + s[b] + s[c]):
				m = 'YES'
if m == 'YES':
	print(m)
else:
	print('NO')


import itertools
a = [int(i) for i in input().split()]
n = len(a)
ns = n // 2
f = True
for i in itertools.permutations(a):
	if sum(i[:ns]) == sum(i[ns:]):
		print('YES')
		f = False
		break
if f:
	print('NO')


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

def lalala(s, f):
	n = [s[0]]
	for i in range(1, 5):
		n += [s[i]]
		for j in range(i + 1, 6):
			f = s.copy()
			n += [s[j]]
			for element in n:
				f.remove(element)
			if sum(n) == sum(f):
				return True
			else:
				n.pop()
		n = [s[0]]
if lalala(s, f):
	print('YES')
else:
	print('NO')


import itertools
scores = map(int, input().split())
for i in itertools.permutations(scores):
	if sum(i[:3]) == sum(i[3:]):
		print('Yes')
		break
else:
	print('No')


(a, b, c, d, e, f) = map(int, input().split())
if (a + b + c + d + f + e) % 2 == 0:
	s = (a + b + c + d + f + e) / 2
	if a + b + c == s or a + b + d == s or a + b + e == s or (a + b + f == s) or (a + c + d == s) or (a + c + e == s) or (a + c + f == s) or (a + d + e == s) or (a + d + f == s) or (a + e + f == s):
		print('YES')
	else:
		print('NO')
else:
	print('NO')


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

def sol():
	target = sum(lst) / 2
	if target.is_integer():
		for i in range(len(lst) - 2):
			for j in range(i + 1, len(lst) - 1):
				for k in range(j + 1, len(lst)):
					if lst[i] + lst[j] + lst[k] == int(target):
						return 'YES'
	return 'NO'
print(sol())


from itertools import permutations
m = list(map(int, input().split()))
for p in permutations(m):
	if p[0] + p[1] + p[2] == p[3] + p[4] + p[5]:
		print('YES')
		exit()
print('NO')


a = list(map(int, input().split()))
a.sort()
s = sum(a)
for i in range(6):
	for y in range(6):
		for z in range(6):
			if i != y and y != z and (z != i) and (a[i] + a[y] + a[z] == s / 2):
				print('YES')
				exit()
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')
				exit(0)
print('NO')


import itertools
a = list(map(int, input().split()))
s = sum(a)
if s % 2 != 0:
	print('NO')
	exit()
combs = itertools.combinations(a, 3)
for comb in combs:
	if s - sum(comb) == s // 2:
		print('YES')
		exit()
print('NO')


def f(a, b):
	if len(a) == 6:
		x = sum(a[0:3])
		y = sum(a[3:6])
		if x == y:
			return True
	else:
		for i in range(len(b)):
			x = b[i]
			j = i + 1
			k = len(b)
			remaining = b[0:i] + b[j:k]
			selected = a + [x]
			if f(selected, remaining):
				return True

def ff(a):
	print('YES' if f([], a) else 'NO')
a = [int(x) for x in input().split()]
ff(a)


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 + 1, 6):
			for c in range(b + 1, 6):
				if lst[a] + lst[b] + lst[c] == avr and (not hasPrint):
					print('YES')
					hasPrint = True
	if not hasPrint:
		print('No')


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

def main(a):
	b = a.copy()
	for i in range(6):
		first = b[i]
		b.remove(b[i])
		for j in range(5):
			second = b[j]
			b.remove(b[j])
			for k in range(4):
				third = b[k]
				b.remove(b[k])
				if first + second + third == sum(b):
					return 'YES'
				b = a.copy()
				b.remove(b[i])
				b.remove(b[j])
			b = a.copy()
			b.remove(b[i])
		b = a.copy()
	return 'NO'
print(main(a))


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')


def strenght(power, summ):
	for i in range(len(power) - 2):
		for j in range(i + 1, len(power) - 1):
			for k in range(j + 1, len(power)):
				if power[i] + power[j] + power[k] == summ / 2:
					return 'YES'
	return 'NO'
power = list(map(int, input().split()))
summ = sum(power)
print(strenght(power, summ))


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


a = list(map(int, input().split()))
i = 0
a.sort()
while i <= 3:
	ii = i + 1
	while ii <= 4:
		iii = ii + 1
		while iii <= 5:
			test = list(range(6))
			test.pop(test.index(i))
			test.pop(test.index(ii))
			test.pop(test.index(iii))
			su = 0
			for iiii in test:
				su += a[iiii]
			if a[i] + a[ii] + a[iii] == su:
				print('YES')
				exit()
			iii += 1
		ii += 1
	i += 1
else:
	print('NO')


from itertools import permutations
print(['NO', 'YES'][any((sum(x[:3]) == sum(x[3:]) for x in permutations(map(int, input().split()))))])


from itertools import combinations
l = list(map(int, input().split()))
s = sum(l)
f = 0
if s % 2 != 0:
	print('NO')
	f = 1
else:
	for i in combinations(l, 3):
		if sum(i) == s // 2:
			print('YES')
			f = 1
			break
if f == 0:
	print('NO')


a = list(map(int, input().split()))
for i in range(6):
	for j in range(6):
		for z in range(6):
			for i1 in range(6):
				for j1 in range(6):
					for z1 in range(6):
						if i != j and i != z and (i != i1) and (i != j1) and (i != z1) and (j != z) and (j != i1) and (j != j1) and (j != z1) and (z != i1) and (z != j1) and (z != z1) and (i1 != j1) and (i1 != z1) and (j1 != z1):
							if a[i] + a[j] + a[z] == a[i1] + a[j1] + a[z1]:
								print('YES')
								exit()
print('NO')


power = [int(s) for s in input().split()]
a = 'NO'
s = power[0] + power[1] + power[2] + power[3] + power[4] + power[5]
for i in range(0, 6):
	for k in range(0, 6):
		for j in range(0, 6):
			if i != k and j != k and (i != j):
				if power[i] + power[j] + power[k] == s - (power[i] + power[j] + power[k]):
					a = 'YES'
print(a)


a = list(map(int, input().split()))
c = 0
for i in range(0, 4):
	for j in range(i + 1, 5):
		for k in range(j + 1, 6):
			if (a[i] + a[k] + a[j]) * 2 == sum(a):
				c = 1
if c == 1 and sum(a) % 2 == 0:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
x = 0
for i in range(6):
	for j in range(6):
		for k in range(6):
			if i != j != k != i:
				x = a[i] + a[j] + a[k]
				y = 0
				for z in range(6):
					if z != i and z != j and (z != k):
						y += a[z]
				if x == y:
					print('YES')
					exit()
else:
	print('NO')


a = []
a = input().split()
for i in range(6):
	a[i] = int(a[i])
sum1 = 0
sum2 = 0
i = 0
flag = 0
if a[i] + a[i + 1] + a[i + 2] == a[i + 3] + a[i + 4] + a[i + 5]:
	flag = 1
elif a[i] + a[i + 1] + a[i + 3] == a[i + 2] + a[i + 4] + a[i + 5]:
	flag = 1
elif a[i] + a[i + 1] + a[i + 4] == a[i + 2] + a[i + 3] + a[i + 5]:
	flag = 1
elif a[i] + a[i + 1] + a[i + 5] == a[i + 2] + a[i + 4] + a[i + 3]:
	flag = 1
elif a[0] + a[2] + a[3] == a[1] + a[4] + a[5]:
	flag = 1
elif a[0] + a[2] + a[4] == a[1] + a[3] + a[5]:
	flag = 1
elif a[0] + a[2] + a[5] == a[1] + a[3] + a[4]:
	flag = 1
elif a[0] + a[2] + a[5] == a[1] + a[3] + a[4]:
	flag = 1
elif a[0] + a[3] + a[4] == a[1] + a[2] + a[5]:
	flag = 1
elif a[0] + a[3] + a[5] == a[1] + a[2] + a[4]:
	flag = 1
elif a[0] + a[4] + a[5] == a[1] + a[2] + a[3]:
	flag = 1
elif a[1] + a[2] + a[3] == a[0] + a[4] + a[5]:
	flag = 1
elif a[1] + a[3] + a[4] == a[0] + a[5] + a[2]:
	flag = 1
elif a[1] + a[4] + a[5] == a[0] + a[2] + a[3]:
	flag = 1
elif a[1] + a[2] + a[4] == a[0] + a[3] + a[5]:
	flag = 1
elif a[1] + a[2] + a[5] == a[0] + a[3] + a[4]:
	flag = 1
elif a[1] + a[3] + a[5] == a[0] + a[2] + a[4]:
	flag = 1
elif a[2] + a[3] + a[4] == a[1] + a[0] + a[5]:
	flag = 1
elif a[5] + a[2] + a[4] == a[1] + a[3] + a[0]:
	flag = 1
elif a[0] + a[1] + a[4] == a[2] + a[3] + a[5]:
	flag = 1
elif a[5] + a[4] + a[3] == a[1] + a[0] + a[2]:
	flag = 1
if flag == 1:
	print('YES')
else:
	print('NO')


import itertools
a = []
a = [int(i) for i in input().split()]
half = sum(a) / 2
flag = 0
for i in itertools.combinations(a, 3):
	if sum(i) == half:
		flag = 1
		break
if flag == 1:
	print('YES')
else:
	print('NO')


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


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


from itertools import permutations as perms

def main():
	read = lambda : tuple(map(int, input().split()))
	l = read()
	for p in perms(l):
		if sum(p[:3]) == sum(p[3:]):
			return 'YES'
	return 'NO'
print(main())


a = list(map(int, input().split()))
indicator = False
for i1 in range(6):
	if indicator:
		break
	for i2 in range(6):
		if indicator:
			break
		if i2 == i1:
			continue
		for i3 in range(6):
			if i3 == i2 or i3 == i1:
				continue
			team1 = {i1, i2, i3}
			sum1 = a[i1] + a[i2] + a[i3]
			sum2 = 0
			for j in range(6):
				if j not in team1:
					sum2 += a[j]
			if sum1 == sum2:
				indicator = True
				break
if indicator:
	print('YES')
else:
	print('NO')


import itertools
s = list(map(lambda x: int(x), input().split()))
itg = list(itertools.permutations(s, 6))
m = False
for comb in itg:
	if sum(comb[:3]) == sum(comb[3:]):
		m = True
if m:
	print('YES')
else:
	print('NO')


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

def ch(b, c, d):
	if a[b] + a[c] + a[d] == sum(a) - (a[b] + a[c] + a[d]):
		return True
	return False
for i in range(6):
	for j in range(6):
		for q in range(6):
			if i != j and j != q and (i != q):
				if ch(i, j, q):
					ans = 'YES'
print(ans)


s = input().split()
for i in range(len(s)):
	s[i] = int(s[i])
s = sorted(s)
ans = 'NO'
for i in range(4):
	if ans == 'YES':
		break
	for j in range(i + 1, 5):
		if ans == 'YES':
			break
		for k in range(j + 1, 6):
			if ans == 'YES':
				break
			if s[i] + s[j] + s[k] == sum(s) / 2:
				ans = 'YES'
print(ans)


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def ceildiv(x, y):
	return (x + y - 1) // y
a = list(map(int, input().split()))
ss = sum(a)
if ss % 2:
	print('NO')
else:
	ch = 1
	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] == ss // 2:
					print('YES')
					ch = 0
					break
			if not ch:
				break
		if not ch:
			break
	if ch:
		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')


a = [int(i) for i in input().split()]
o = False
n = a[1] + a[2] + a[0] + a[3] + a[4] + a[5]
if n % 2 == 0:
	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] == n // 2:
					o = True
					break
if o:
	print('YES')
else:
	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 < 4:
	j = i + 1
	while j < 5:
		k = j + 1
		while k < 6:
			if n[i] + n[j] + n[k] == sum / 2:
				print('YES')
				break
			else:
				k += 1
		else:
			k = 5
		if n[i] + n[j] + n[k] == sum / 2:
			break
		else:
			j += 1
	else:
		j = 4
	if n[i] + n[j] + n[k] == sum / 2:
		break
	else:
		i += 1
else:
	print('NO')


s = list(map(int, input().split()))
t = sum(s)
e = 0
if t % 2 != 0:
	print('NO')
else:
	for a in range(4):
		if e == 1:
			break
		for b in range(a + 1, 5):
			if e == 1:
				break
			for c in range(b + 1, 6):
				if s[a] + s[b] + s[c] == t // 2:
					e = 1
					print('YES')
					break
				else:
					e = e
	if e == 0:
		print('NO')


import itertools
users = list(map(int, input().split()))
array_permutation = list(itertools.permutations(users))
count = 0
for i in array_permutation:
	if i[0] + i[1] + i[2] == i[3] + i[4] + i[5] and count == 0:
		count += 1
if count == 0:
	print('NO')
else:
	print('YES')


a = [int(x) for x in input().split()]
s = sum(a)
x = 0
for i in range(6):
	for j in range(i + 1, 6):
		for l in range(j + 1, 6):
			if a[i] + a[j] + a[l] == s / 2:
				x = 1
if x == 1:
	print('YES')
else:
	print('NO')


l = list(map(int, input().split()))
l.sort()
a = l[0] + l[5] + l[2]
b = l[0] + l[5] + l[3]
c = l[1] + l[4] + l[3]
d = l[1] + l[4] + l[2]
e = l[0] + l[3] + l[4]
f = l[1] + l[2] + l[5]
g = l[0] + l[1] + l[5]
h = l[4] + l[3] + l[2]
i = l[1] + l[2] + l[3]
j = l[0] + l[4] + l[5]
k = l[2] + l[3] + l[4]
l = l[0] + l[1] + l[5]
if a == c:
	print('YES')
elif b == d:
	print('YES')
elif e == f:
	print('YES')
elif g == h:
	print('YES')
elif i == j:
	print('YES')
elif k == l:
	print('YES')
else:
	print('NO')


data = list(map(int, input().split()))
for i in range(6):
	for j in range(6):
		for k in range(6):
			if i != k and i != j and (k != j):
				d = [i, j, k]
				su1 = 0
				su2 = 0
				for l in range(6):
					if l not in d:
						su1 += data[l]
					else:
						su2 += data[l]
				if su1 == su2:
					print('YES')
					exit()
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
r = a + b + c + e + f
t = a + b + d + e + f
u = a + c + d + e + f
o = b + c + d + e + f
k = a + b + c + d + e
if a > o:
	print('no')
elif b > u:
	print('no')
elif c > t:
	print('no')
elif d > r:
	print('NO')
elif e > q:
	print('no')
elif f > k:
	print('No')
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')


IL = lambda : list(map(int, input().split()))
I = lambda : int(input())
import itertools
a = IL()
sa = sum(a)
tm = list(map(sum, itertools.permutations(a, 3)))
print('YES' if sa / 2 in tm else 'NO')


a = [int(i) for i in input().split()]
s = sum(a)
for i in range(6):
	for j in range(6):
		if i == j:
			continue
		for z in range(6):
			if j == z or i == z:
				continue
			s1 = a[i] + a[j] + a[z]
			if s1 == s - s1:
				print('YES')
				exit()
print('NO')


arr = list(map(int, input().split()))
n = len(arr)
if n % 2 != 0:
	print('NO')
ans = False
for i in range(n):
	if ans:
		break
	for j in range(n):
		if i == j:
			continue
		if ans:
			break
		for k in range(n):
			if i == k or j == k:
				continue
			if arr[i] + arr[j] + arr[k] == sum(arr, 0) / 2:
				ans = True
				break
if ans:
	print('YES')
else:
	print('NO')


c = list(map(int, input().split()))
while True:
	if c[0] + c[1] + c[2] == c[3] + c[4] + c[5]:
		print('YES')
		break
	elif c[0] + c[1] + c[3] == c[2] + c[4] + c[5]:
		print('YES')
		break
	elif c[0] + c[1] + c[4] == c[2] + c[3] + c[5]:
		print('YES')
		break
	elif c[0] + c[1] + c[5] == c[2] + c[3] + c[4]:
		print('YES')
		break
	elif c[0] + c[2] + c[3] == c[1] + c[4] + c[5]:
		print('YES')
		break
	elif c[0] + c[2] + c[4] == c[1] + c[3] + c[5]:
		print('YES')
		break
	elif c[0] + c[2] + c[5] == c[1] + c[3] + c[4]:
		print('YES')
		break
	elif c[0] + c[3] + c[4] == c[1] + c[2] + c[5]:
		print('YES')
		break
	elif c[0] + c[3] + c[5] == c[1] + c[2] + c[4]:
		print('YES')
		break
	elif c[0] + c[4] + c[5] == c[1] + c[2] + c[3]:
		print('YES')
		break
	else:
		print('NO')
		break


a = [int(i) for i in input().split()]
s = sum(a)
if s % 2 == 1:
	print('NO')
else:
	s /= 2
	f = True
	for n1 in range(4):
		for n2 in range(n1 + 1, 5):
			for n3 in range(n2 + 1, 6):
				if a[n1] + a[n2] + a[n3] == s:
					break
			else:
				continue
			break
		else:
			continue
		break
	else:
		f = False
	print('YES' if f else 'NO')


a = list(map(int, input().split()))
for i in range(len(a)):
	for j in range(len(a)):
		if i == j:
			continue
		for i1 in range(len(a)):
			if i1 == i or i1 == j:
				continue
			if a[i] + a[j] + a[i1] == sum(a) - (a[i] + a[j] + a[i1]):
				print('YES')
				exit()
print('NO')


L = list(map(int, input().split()))
if sum(L) % 2 == 1:
	print('NO')
else:
	H = [L[0], 0, 0]
	test = False
	for i in range(1, 5):
		H[1] = L[i]
		for j in range(i + 1, len(L)):
			H[2] = L[j]
			if sum(H) == sum(L) // 2:
				print('YES')
				test = True
				break
		if test:
			break
	if test == False:
		print('NO')


from itertools import combinations as c
y = [int(i) for i in input().split()]
z = list(c(y, 3))
d = []
for i in range(10):
	d.append([z[i], z[19 - i]])
x = 0
for i in d:
	if sum(i[0]) == sum(i[1]):
		x += 1
	else:
		pass
print('yes') if x >= 1 else print('no')


lst = input()
lst = lst.split()
sum = 0
for i in range(len(lst)):
	lst[i] = int(lst[i])
	sum += lst[i]
flag = False
for i in range(4):
	for j in range(i + 1, 5):
		for g in range(j + 1, 6):
			if lst[i] + lst[j] + lst[g] == sum - (lst[i] + lst[j] + lst[g]):
				print('YES')
				flag = True
				exit()
if not flag:
	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')


a = list(map(int, input().rsplit()))
sum = 0
p = 1
for i in range(6):
	sum = sum + a[i]
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] == sum / 2:
				p = 0
if p == 0:
	print('YES')
else:
	print('NO')


import itertools
ns = list(map(int, input().split()))
l = len(ns)
l2 = len(ns) // 2
for i in itertools.permutations(ns):
	if sum(i[:l2]) == sum(i[l2:]):
		print('YES')
		break
else:
	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)


n = list(map(int, input().split()))
x = len(n)
checked = [False, False, False, False, False, False]

def check(cur1, cur2):
	if sum(checked) == 6:
		if cur1 == cur2:
			print('YES')
			exit()
	for i in range(x):
		if checked[i] == False:
			checked[i] = True
			for j in range(x):
				if checked[j] == False:
					checked[j] = True
					check(cur1 + n[i], cur2 + n[j])
					checked[j] = False
			checked[i] = False
check(0, 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] + a[k]
			sum2 = sum(a) - sum1
			if sum1 == sum2:
				flag = False
print('NO' if flag else 'YES')


cnt = 0
now = 0
masln = list(map(int, input().split()))
isans = False
for i in range(6):
	for j in range(6):
		for k in range(6):
			lst = []
			for l in range(6):
				if i == l or j == l or k == l:
					continue
				lst.append(l)
			if i == j or i == k or k == j:
				continue
			if masln[i] + masln[j] + masln[k] == masln[lst[0]] + masln[lst[1]] + masln[lst[2]]:
				isans = True
				break
		if isans:
			break
	if isans:
		break
if not isans:
	print('NO')
else:
	print('YES')


ar = list(map(int, input().split(' ')))
s = sum(ar)
if s % 2 != 0:
	print('NO')
else:
	ar.sort()
	for i in range(6):
		for j in range(i + 1, 6):
			for k in range(j + 1, 6):
				su = ar[i] + ar[j] + ar[k]
				if su == s - su:
					print('YES')
					exit()
	print('NO')


a = [int(i) for i in input().split()]
s = 0
b = 0
for i in range(6):
	s += a[i]
for i in range(2, 6):
	if a[0] + a[1] + a[i] == s / 2:
		print('YES')
		break
	elif a[0] + a[2] + a[i] == s / 2 and i >= 3:
		print('YES')
		break
	elif a[0] + a[3] + a[i] == s / 2 and i >= 4:
		print('YES')
		break
	elif a[0] + a[4] + a[5] == s / 2:
		print('YES')
		break
	else:
		b += 1
if b == 4:
	print('NO')


import itertools
forces = list(map(int, input().split()))
ok = False
thislen = len(forces) // 2
for i in itertools.permutations(forces):
	if sum(i[:thislen]) == sum(i[thislen:]):
		ok = True
		break
if ok:
	print('YES')
else:
	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
a = list(map(int, input().split()))
s = sum(a)
ind = 0
for i in itertools.combinations('012345', 3):
	b = list(i)
	if (a[int(b[0])] + a[int(b[1])] + a[int(b[2])]) * 2 == s:
		ind = 1
		print('YES')
		break
if ind == 0:
	print('NO')


A = list(map(int, input().split()))
flag = False
for i in range(6):
	pow1 = A[i]
	used1 = [i]
	for j in range(6):
		if j not in used1:
			pow2 = pow1 + A[j]
			used2 = used1 + [j]
			for k in range(6):
				if k not in used2:
					pow3 = pow2 + A[k]
					used3 = used2 + [k]
					for l in range(6):
						if l not in used3:
							pow4 = pow3 - A[l]
							used4 = used3 + [l]
							for m in range(6):
								if m not in used4:
									pow5 = pow4 - A[m]
									used5 = used4 + [m]
									for n in range(6):
										if n not in used5:
											pow6 = pow5 - A[n]
											if pow6 == 0:
												flag = True
ans = flag and 'YES' or 'NO'
print(ans)


l = list(map(int, input().split()))
m = sum(l)
r = m // 2
if m % 2 != 0:
	print('NO')
	exit()
else:
	for i in range(6):
		for j in range(i + 1, 6):
			for k in range(j + 1, 6):
				if l[i] + l[j] + l[k] == r:
					print('YES')
					exit()
	print('NO')


l = list(map(int, input().split()))
s = sum(l)
l.sort()
i = 0
x = True
if s % 2 != 0:
	print('NO')
elif any([i > s / 2 for i in l]):
	print('NO')
else:
	s = s // 2 - max(l)
	for i in range(len(l) - 2):
		for j in range(i + 1, len(l) - 1):
			if l[j] + l[i] == s:
				print('YES')
				x = False
				break
		if not x:
			break
	if x:
		print('NO')


(a1, a2, a3, a4, a5, a6) = map(int, input().split())
a = []
a.append(a1)
a.append(a2)
a.append(a3)
a.append(a4)
a.append(a5)
a.append(a6)
k = 0
for i in range(6):
	for j in range(6):
		for q in range(6):
			if i != j and i != q and (q != j) and (a[i] + a[j] + a[q] == sum(a) - (a[i] + a[j] + a[q])):
				k += 1
if k != 0:
	print('YES')
else:
	print('NO')


l = list(map(int, input().split()))
su = sum(l)
if su % 2 != 0:
	print('NO')
	exit()
for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			if l[i] + l[j] + l[k] == su // 2:
				print('YES')
				exit()
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')


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) - (a[i] + a[j] + a[k]):
				if a == [4, 4, 4, 4, 5, 4]:
					print(i, j, k)
				print('YES')
				exit()
print('NO')


a = [int(i) for i in input().split()]
s = sum(a)

def solve():
	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]) * 2 == s:
					return 'YES'
	return 'NO'
print(solve())


a = list(input().split(' '))
a = [int(i) for i in a]
s = 1
hh = 1
c = 0
if sum(a) % 2 != 0:
	hh = 0
else:
	c = int(sum(a) / 2)
import itertools
b = [x for x in itertools.combinations(a, 3)]
k = [sum(m) for m in b]
if c in k:
	s = 1
else:
	s = 0
if s * hh == 1:
	print('YES')
else:
	print('NO')


from itertools import permutations
print(['NO', 'YES'][any((sum(a[:3]) == sum(a[3:]) for a in permutations(list(map(int, input().split())))))])


arr = [int(s) for s in input().split()]
s = 0
for i in range(6):
	s += arr[i]
flag = False
for a in range(4):
	for b in range(a + 1, 5):
		for c in range(b + 1, 6):
			if (arr[a] + arr[b] + arr[c]) * 2 == s:
				flag = True
if flag:
	print('YES')
else:
	print('NO')


a = str(input()).split()
a1 = int(a[0])
a2 = int(a[1])
a3 = int(a[2])
a4 = int(a[3])
a5 = int(a[4])
a6 = int(a[5])
if a1 + a2 + a3 == a4 + a5 + a6 or a1 + a2 + a4 == a3 + a5 + a6 or a1 + a2 + a5 == a3 + a4 + a6 or (a1 + a2 + a6 == a3 + a5 + a4) or (a2 + a3 + a4 == a1 + a5 + a6) or (a3 + a2 + a5 == a1 + a6 + a4) or (a3 + a2 + a6 == a1 + a5 + a4) or (a4 + a2 + a5 == a3 + a1 + a6) or (a4 + a2 + a6 == a3 + a5 + a1) or (a5 + a2 + a6 == a3 + a1 + a4):
	print('YES')
else:
	print('NO')


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


a = [int(i) for i in input().split()]
boo = False
sa = a[0] + a[1] + a[2] + a[3] + a[4] + a[5]
for i in range(4):
	for j in range(i + 1, 5):
		for k in range(j + 1, 6):
			if a[i] + a[k] + a[j] == sa - (a[i] + a[k] + a[j]):
				boo = True
if boo == True:
	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 + 1, 6):
			for t in range(j + 1, 6):
				k = l[i] + l[j] + l[t]
				o.append(abs(k - h))
	if min(o) == 0:
		print('YES')
	else:
		print('NO')


p = list(map(int, input().split()))
t = []
for a in range(0, 4):
	for b in range(a + 1, 5):
		for c in range(b + 1, 6):
			t.append((p[a], p[b], p[c]))
for x in t:
	if sum(x) == sum(p) - sum(x):
		print('YES')
		t = 1
		break
if t != 1:
	print('NO')


flag = False
s = 0
a = list(map(int, input().split()))
for i in range(6):
	s = s + a[i]
if s % 2 != 0:
	print('NO')
else:
	for i in range(1, 5):
		if flag == True:
			break
		for j in range(i + 1, 6):
			if a[i] + a[j] == s / 2 - a[0]:
				flag = True
				break
	if flag == False:
		print('NO')
	else:
		print('YES')


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


a = [int(x) for x in input().split()]
s = sum(a)
done = False
for i in range(1, 6):
	if done:
		break
	for j in range(i + 1, 6):
		total = a[0] + a[i] + a[j]
		rest = s - total
		if total == rest:
			print('YES')
			done = True
			break
if not done:
	print('NO')


import sys

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')


from sys import stdin, stdout
from itertools import permutations
data = stdin.readline().rstrip().split(' ')
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')


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


m = list(map(int, input().split()))
s = sum(m)
lol = 0
for i in range(0, 6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			if s - (m[i] + m[j] + m[k]) == m[i] + m[j] + m[k]:
				lol = 1
if lol == 0:
	print('NO')
else:
	print('YES')


def main():
	arr = list(map(int, input().split()))
	used = []
	for first in range(len(arr)):
		used = [first]
		for second in range(len(arr)):
			if second in used:
				continue
			used.append(second)
			for third in range(len(arr)):
				if third in used:
					continue
				used.append(third)
				s1 = arr[used[0]] + arr[used[1]] + arr[used[2]]
				s2 = 0
				for i in range(len(arr)):
					if i not in used:
						s2 = s2 + arr[i]
				if s2 == s1:
					print('YES')
					return 0
				used.pop()
			used.pop()
		used.pop()
	print('NO')
	return 0
main()


a = list(map(int, input().split()))
s = sum(a) / 2
flag = False
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] == s:
				print('YES')
				flag = True
				break
		if flag:
			break
	if flag:
		break
if not flag:
	print('NO')


a = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
b = a[0] + a[1] + a[2] + a[3] + a[4] + a[5]
l = 0
if b % 2 == 0:
	for T in range(1, 6):
		for t in range(1, T):
			if a[0] + a[T] + a[t] == b / 2:
				l = 1
	if l == 1:
		print('YES')
elif b % 2 == 0:
	for T in range(1, 6):
		for t in range(T, 6):
			if a[0] + a[T] + a[t] == b / 2:
				l = 1
	if l == 1:
		print('YES')
if l == 0:
	print('NO')


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')


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')


s = input()
a = []
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
t = 0
if a[0] + a[1] + a[2] == a[3] + a[4] + a[5]:
	t += 1
if a[0] + a[1] + a[3] == a[2] + a[4] + a[5]:
	t += 1
if a[0] + a[1] + a[4] == a[2] + a[3] + a[5]:
	t += 1
if a[0] + a[1] + a[5] == a[2] + a[3] + a[4]:
	t += 1
if a[0] + a[2] + a[3] == a[1] + a[4] + a[5]:
	t += 1
if a[0] + a[2] + a[4] == a[1] + a[3] + a[5]:
	t += 1
if a[0] + a[2] + a[5] == a[1] + a[3] + a[4]:
	t += 1
if a[0] + a[3] + a[4] == a[1] + a[2] + a[5]:
	t += 1
if a[0] + a[3] + a[5] == a[1] + a[2] + a[4]:
	t += 1
if a[0] + a[4] + a[5] == a[1] + a[2] + a[3]:
	t += 1
if t > 0:
	print('YES')
else:
	print('NO')


from itertools import permutations
a = [int(i) for i in input().split()]
c = 0
pre = list(permutations(a))
for i in pre:
	if sum(i[:3]) == sum(i[3:]):
		c += 1
if c:
	print('YES')
else:
	print('NO')


s = [int(x) for x in input().split()]
summa = sum(s)
if summa % 2 != 0:
	print('NO')
else:
	check = False
	teamp = summa / 2
	for q in range(6):
		for w in range(6):
			for e in range(6):
				if q != w and q != e and (w != e) and (s[q] + s[w] + s[e] == teamp):
					check = True
	if check == True:
		print('YES')
	else:
		print('NO')


def main():
	arr = input()
	arr = arr.split(' ')
	for i in range(0, 6):
		for j in range(0, 6):
			for k in range(0, 6):
				if i == j or j == k or i == k:
					continue
				else:
					cache = arr[:]
					a = arr[i]
					b = arr[j]
					c = arr[k]
					cache.remove(a)
					cache.remove(b)
					cache.remove(c)
					sum1 = int(a) + int(b) + int(c)
					sum2 = int(cache[0]) + int(cache[1]) + int(cache[2])
					if sum1 == sum2:
						print('yes')
						return
	print('no')
	return
main()


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])


from sys import stdin
a = [int(i) for i in stdin.readline().split(' ')]
s = sum(a)
possible = False
for i in range(1, 5):
	for j in range(i + 1, 6):
		team = a[0] + a[i] + a[j]
		if team == s - team:
			possible = True
if possible:
	print('YES')
else:
	print('NO')


a = []
a = [int(i) for i in input().split(' ')]
for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			b = set(range(6))
			b.remove(i)
			b.remove(j)
			b.remove(k)
			b = list(b)
			if a[i] + a[j] + a[k] == a[b[0]] + a[b[1]] + a[b[2]]:
				print('yes')
				exit()
print('no')


from itertools import combinations
a = list(map(int, input().split()))
x = list(combinations([0, 1, 2, 3, 4, 5], 3))
for i in x:
	m = list(i)
	q = a[m[0]] + a[m[1]] + a[m[2]]
	g = sum(a) - q
	if q == g:
		print('YES')
		exit(0)
print('NO')


a = list(map(int, input().split()))
for i in range(6):
	for j in range(i + 1, 6):
		for g in range(j + 1, 6):
			sum1 = a[i] + a[j] + a[g]
			sum2 = 0
			for k in range(6):
				if k != i and k != j and (k != g):
					sum2 += a[k]
			if sum1 == sum2:
				print('YES')
				exit(0)
print('NO')


q = list(map(int, input().split()))
w = [0, 0, 0, 0, 0, 0]
ask = 'NO'
for i in range(0, 64):
	for j in range(5, -1, -1):
		if w[j] == 0:
			w[j] = 1
			for u in range(j + 1, 6):
				w[u] = 0
			break
	if w.count(1) == 3:
		ateam = 0
		bteam = 0
		for i in range(0, 6):
			if w[i] == 1:
				ateam += q[i]
			else:
				bteam += q[i]
		if ateam == bteam:
			ask = 'YES'
print(ask)


l = list(map(int, input().split()))
y = False
s = sum(l)
i = 0
while i < 4 and (not y):
	j = i + 1
	while j < 5 and (not y):
		k = j + 1
		while k < 6 and (not y):
			t = l[i] + l[j] + l[k]
			if t == s - t:
				y = True
			k += 1
		j += 1
	i += 1
if y:
	print('YES')
else:
	print('NO')


n = list(map(int, input().split()))
Sum = sum(n)
r = False
for i in range(len(n)):
	for j in range(i + 1, len(n)):
		for k in range(j + 1, len(n)):
			if n[i] + n[j] + n[k] == Sum / 2:
				r = True
if r == True:
	print('YES')
else:
	print('NO')


from itertools import permutations
s = map(int, input().split())
for i in permutations(s, 6):
	if i[0] + i[1] + i[2] == i[3] + i[4] + i[5]:
		print('YES')
		break
else:
	print('NO')


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))


k = list(map(int, input().split(' ')))
if k[0] + k[1] + k[3] == k[2] + k[4] + k[5] or k[0] + k[1] + k[2] == k[3] + k[4] + k[5] or k[0] + k[1] + k[4] == k[2] + k[3] + k[5] or (k[0] + k[1] + k[5] == k[3] + k[4] + k[2]) or (k[0] + k[2] + k[3] == k[1] + k[4] + k[5]) or (k[0] + k[2] + k[4] == k[1] + k[3] + k[5]) or (k[0] + k[2] + k[5] == k[1] + k[4] + k[3]) or (k[0] + k[4] + k[3] == k[1] + k[2] + k[5]) or (k[0] + k[5] + k[3] == k[1] + k[4] + k[2]) or (k[0] + k[4] + k[5] == k[1] + k[2] + k[3]):
	print('Yes')
else:
	print('No')


n = input()
n = n.split()
for i in range(0, len(n)):
	n[i] = int(n[i])
sum = 0
for i in n:
	sum += i
fl = 0
for i in range(4):
	if fl == 0:
		for j in range(i + 1, 5):
			if fl == 0:
				for k in range(j + 1, 6):
					an_sum = n[i] + n[j] + n[k]
					if an_sum == sum - an_sum:
						print('Yes')
						fl = 1
						break
if fl == 0:
	print('No')


a = [i for i in map(int, input().split())]
total = sum(a)
ans = False
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 == total:
				ans = True
print('YES' if ans else 'NO')


a = list(map(int, input().split()))
s = 0
for t in a:
	s += t

def check(a, s):
	for i in range(6):
		for j in range(i + 1, 6):
			for g in range(j + 1, 6):
				if a[i] + a[j] + a[g] == s / 2:
					return 'YES'
	return 'NO'
print(check(a, s))


from itertools import permutations
a = [int(x) for x in input().split()]
for p in permutations(a):
	if p[0] + p[1] + p[2] == p[3] + p[4] + p[5]:
		print('YES')
		exit()
print('NO')


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


a = list(map(int, input().split()))
a.sort(reverse=True)
if sum(a) % 2 == 0:
	ketemu = False
	dicari = sum(a) / 2
	for i in range(1, len(a)):
		for j in range(2, len(a)):
			if i != j and a[0] + a[i] + a[j] == dicari:
				ketemu = True
	print('YES') if ketemu else print('NO')
else:
	print('NO')


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


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def msi():
	return map(str, input().split())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def lsi():
	return list(msi())

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
mod = 1000000007

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1
from math import log, factorial, cos, tan, sin, radians, floor, sqrt, log2
import bisect
import random
import string
from decimal import *

def main():
	a = li()
	s = sum(a)
	if s & 1:
		print('NO')
		return
	s = s // 2
	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:
					print('YES')
					return
	print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import itertools

def raw_input(n):
	contents = []
	for a in range(n):
		try:
			line = input()
		except EOFError:
			break
		contents.append(line)
	return contents
data = [int(a) for a in input().split(' ', -1)]
for b in itertools.permutations(data):
	if b[0] + b[1] + b[2] == b[3] + b[4] + b[5]:
		print('YES')
		quit()
print('NO')


Q = list(map(int, input().split()))
A = 0
for x in range(1, 5):
	for y in range(x + 1, 6):
		B = 0
		for i in range(1, 6):
			if i != x and i != y:
				B += Q[i]
		if B == Q[0] + Q[x] + Q[y]:
			A = 1
if A == 1:
	print('YES')
else:
	print('NO')


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


competitors = sorted([int(i) for i in input().split()])
flag = True
oth_competitors = []

def balance(competitors):
	for x in competitors[:]:
		competitors.remove(x)
		oth_competitors.append(x)
		for l in competitors[:]:
			competitors.remove(l)
			oth_competitors.append(l)
			for i in competitors[:]:
				competitors.remove(i)
				oth_competitors.append(i)
				if sum(competitors) == sum(oth_competitors):
					return 'YES'
				competitors += [i]
				oth_competitors.remove(i)
			competitors += [l]
			oth_competitors.remove(l)
		competitors.append(x)
		oth_competitors.remove(x)
	return 'NO'
print(balance(competitors))


a = list(map(int, input().split()))
if sum(a) % 2 != 0:
	print('NO')
else:
	s = sum(a) // 2 - a[0]
	ans = 'NO'
	for i in range(1, 5):
		if s - a[i] in a[i + 1:]:
			ans = 'YES'
			break
	print(ans)


a = list(map(int, input().split()))
flag = False
for i in range(6):
	for j in range(6):
		if i != j:
			for k in range(6):
				if i != k and j != k:
					cur_sum2 = 0
					for l in range(6):
						if l not in [i, j, k]:
							cur_sum2 += a[l]
					if sum([a[i], a[j], a[k]]) == cur_sum2:
						flag = True
if flag:
	print('YES')
else:
	print('NO')


A = list(map(int, input().split()))
ans = 0
for i in range(len(A)):
	for j in range(len(A)):
		for k in range(len(A)):
			for l in range(len(A)):
				for m in range(len(A)):
					for d in range(len(A)):
						if i != j and i != k and (j != k):
							if l != i and l != j and (l != k) and (m != i) and (m != j) and (m != k) and (d != i) and (d != j) and (d != k):
								if l != d and l != m and (m != d):
									if A[i] + A[j] + A[k] == A[l] + A[m] + A[d]:
										ans = ans + 1
if ans != 0:
	print('YES')
else:
	print('NO')


from itertools import combinations
a = [int(x) for x in input().split()]
b = [0, 1, 2, 3, 4, 5]
k = list(combinations(b, 3))
s = 0
for i in k:
	c = b[:]
	c.remove(i[0])
	c.remove(i[1])
	c.remove(i[2])
	if a[i[0]] + a[i[1]] + a[i[2]] == a[c[0]] + a[c[1]] + a[c[2]]:
		s += 1
if s > 0:
	print('YES')
else:
	print('NO')


a = sorted(map(int, input().split()))
s = sum(a)
if s % 2 != 0:
	print('NO')
	exit(0)
s //= 2
for j in range(1, 6):
	for k in range(j + 1, 6):
		if a[0] + a[j] + a[k] == s:
			print('YES')
			exit(0)
print('NO')


from itertools import *

def main():
	check = False
	a = input()
	list1 = list(a.split(' '))
	for i in permutations(list1, 6):
		if eval(i[0]) + eval(i[1]) + eval(i[2]) == eval(i[3]) + eval(i[4]) + eval(i[5]):
			print('YES')
			check = True
			break
	if check == False:
		print('NO')
main()


n = []
s = 0
flag = False
d = input().split()
for i in range(6):
	d[i] = int(d[i])
	s = s + int(d[i])
if s % 2 == 0:
	for i in range(6):
		for j in range(6):
			for k in range(6):
				if d[i] + d[j] + d[k] == s / 2 and i != j and (i != k) and (k != j):
					flag = True
if flag:
	print('YES')
else:
	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')
main()


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')


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')


n = input().split()
length = len(n)
jumlah = 0
hasil = 0
for i in range(length):
	jumlah += int(n[i])
for i in range(4):
	for j in range(i + 1, 5):
		for k in range(j + 1, 6):
			if (int(n[i]) + int(n[j]) + int(n[k])) * 2 == jumlah:
				hasil += 1
if hasil > 1:
	print('YES')
else:
	print('NO')


from itertools import combinations

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

def output_list(v):
	print(' '.join((str(x) for x in v)))

def main():
	a = input_ints()
	for c in combinations(a, 3):
		if 2 * sum(c) == sum(a):
			print('YES')
			return
	print('NO')
main()


a = list(map(int, input().split(' ')))
sum1 = 0
sum2 = 0
n = len(a)
if sum(a) % 2 == 1:
	print('NO')
	exit()
total = sum(a) // 2
for i in range(n):
	for j in range(i + 1, n):
		for k in range(j + 1, n):
			if i == j or j == k or k == i:
				continue
			if a[i] + a[j] + a[k] == total:
				print('YES')
				exit()
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')


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')


numbers = []
numbers = [int(item) for item in input().split()]
numbers.sort()
if numbers[0] + numbers[5] + numbers[1] == numbers[2] + numbers[3] + numbers[4]:
	print('Yes')
elif numbers[2] + numbers[5] + numbers[1] == numbers[0] + numbers[3] + numbers[4]:
	print('Yes')
elif numbers[0] + numbers[5] + numbers[2] == numbers[1] + numbers[3] + numbers[4]:
	print('Yes')
elif numbers[0] + numbers[5] + numbers[3] == numbers[2] + numbers[1] + numbers[4]:
	print('Yes')
elif numbers[0] + numbers[5] + numbers[4] == numbers[2] + numbers[1] + numbers[3]:
	print('Yes')
else:
	print('No')


(a1, a2, a3, a4, a5, a6) = map(int, input().split())
s = (a1 + a2 + a3 + a4 + a5 + a6) / 2
x1 = a1 + a2 + a3
x2 = a1 + a2 + a4
x3 = a1 + a2 + a5
x4 = a1 + a2 + a6
x5 = a1 + a3 + a4
x6 = a1 + a3 + a5
x7 = a1 + a3 + a6
x8 = a1 + a4 + a5
x9 = a1 + a4 + a6
x10 = a1 + a5 + a6
if x1 == s or x2 == s or x3 == s or (x4 == s) or (x5 == s) or (x6 == s) or (x7 == s) or (x8 == s) or (x9 == s) or (x10 == s):
	print('YES')
else:
	print('NO')


n = list(map(int, input().split()))
a = sum(n)
c = False
for i in range(1, len(n)):
	for j in range(1, len(n)):
		if (n[0] + n[i] + n[j]) * 2 == a and i != j:
			c = True
if c:
	print('YES')
else:
	print('NO')


a = [int(x) for x in input().split()]
sum = sum(a)
f = 0
for i in range(6):
	for j in range(6):
		for k in range(6):
			if i != j and i != k and (j != k) and ((a[i] + a[j] + a[k]) * 2 == sum):
				f = 1
if f == 1:
	print('YES')
else:
	print('NO')


a = list(map(int, input().split()))
sums = set()
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):
				sums.add(a[i] + a[j] + a[k])
if sum(a) / 2 in sums:
	print('YES')
else:
	print('NO')


from itertools import combinations

def main():
	(a, *l) = map(int, input().split())
	s = sum(l) + a
	for (b, c) in combinations(l, 2):
		if (a + b + c) * 2 == s:
			print('YES')
			return
	print('NO')
main()


hihi = [int(i) for i in input().split()]
for i in range(6):
	for j in range(i + 1, 6):
		for k in range(j + 1, 6):
			if sum(hihi) == 2 * (hihi[i] + hihi[j] + hihi[k]):
				print('YES')
				exit()
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')


inp = list(map(int, input().split()))
l = sum(inp)
if l % 2 == 1:
	print('No')
else:
	inp.sort()
	k = 4
	flag = 0
	m = inp[5]
	while k > 0:
		for i in range(0, k):
			if inp[i] + inp[k] == l // 2 - m:
				print('Yes')
				flag = 1
				break
		if flag == 1:
			break
		else:
			k = k - 1
	if flag == 0:
		print('No')


a = list(map(int, input().split()))
s = 0
for i in range(6):
	s += a[i]
if s % 2 != 0:
	print('NO')
	raise SystemExit
else:
	s = s // 2
for i in range(4):
	for j in range(i + 1, 5):
		for e in range(j + 1, 6):
			if a[i] + a[j] + a[e] == s:
				print('YES')
				raise SystemExit
print('NO')


from itertools import permutations
t = 1
while t > 0:
	arr = [int(x) for x in input().split()]
	ok = False
	for l in [list(x) for x in list(permutations(arr, 6))]:
		if sum(l[:3]) == sum(l[3:]):
			print('YES')
			ok = True
			break
	if not ok:
		print('NO')
	t -= 1


import itertools
a = [int(x) for x in input().split()]
for order in itertools.permutations(a, 6):
	if sum(order[:3]) == sum(order[3:]):
		print('YES')
		break
else:
	print('NO')


import sys
import math
import itertools
import functools
import collections
import operator

def ii():
	return int(input())

def mi():
	return map(int, input().split())

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
a = li()
sa = sum(a)
t = a[0]
for i in range(1, 6, 1):
	for j in range(i + 1, 6, 1):
		if t + a[i] + a[j] == sa - (t + a[i] + a[j]):
			exit(print('YES'))
print('NO')


a = [int(i) for i in input().split()]
sumN = 0
for i in range(6):
	sumN += a[i]
if sumN % 2 != 0:
	print('NO')
else:
	sumN //= 2
	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] == sumN:
					print('YES')
					exit(0)
	print('NO')


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

def calc(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):
					left = {i, j, k}
					right = set(range(6)) - left
					s_left = sum((a[i] for i in left))
					s_right = sum((a[i] for i in right))
					if s_left == s_right:
						return 'YES'
		return 'NO'
print(calc(a))


x = [int(w) for w in input().split()]
y = sum(x)
if y & 1 != 0:
	print('NO')
else:
	ans = []
	for i in range(4):
		for j in range(i + 1, 5):
			for k in range(j + 1, 6):
				ans.append(x[i] + x[j] + x[k])
	if y // 2 in ans:
		print('YES')
	else:
		print('NO')


A = list(map(int, input().split()))
s = sum(A) // 2
if sum(A) % 2 != 0:
	print('NO')
	exit(0)
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')


si = input()

def opr(grad):
	l = []
	i = 0
	l.append(0)
	grew = []
	j = len(grad) - 1
	while i < len(grad):
		grew.append(grad[j])
		j -= 1
		i += 1
	i = 0
	m = 0
	j = 0
	while i < len(grew):
		if grew[i] != ' ':
			l[j] += int(grew[i]) * 10 ** m
			m += 1
		if grew[i] == ' ':
			m = 0
			j += 1
			l.append(0)
		i += 1
	g = []
	i = len(l) - 1
	while i >= 0:
		g.append(l[i])
		i -= 1
	return g

def ma(l):
	i = 0
	m = l[i]
	im = 0
	while i < len(l):
		if l[i] > m:
			m = l[i]
			im = i
		i += 1
	return im

def su(l):
	i = 0
	m = 0
	while i < len(l):
		m += l[i]
		i += 1
	return m
l = opr(si)
g = 0
f = 0
b = True
s = su(l)
if s % 2 == 0:
	g += l[ma(l)]
	l.remove(l[ma(l)])
	s = s / 2
	if g + l[0] + l[1] == s:
		print('YES')
		b = False
	if g + l[0] + l[2] == s and b:
		print('YES')
		b = False
	if g + l[0] + l[3] == s and b:
		print('YES')
		b = False
	if g + l[0] + l[4] == s and b:
		print('YES')
		b = False
	if g + l[1] + l[2] == s and b:
		print('YES')
		b = False
	if g + l[1] + l[3] == s and b:
		print('YES')
		b = False
	if g + l[1] + l[4] == s and b:
		print('YES')
		b = False
	if g + l[2] + l[3] == s and b:
		print('YES')
		b = False
	if g + l[2] + l[4] == s and b:
		print('YES')
		b = False
	if g + l[3] + l[4] == s and b:
		print('YES')
		b = False
if b:
	print('NO')


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()


a = list(map(float, input().split()))
b = 0
k = 0
for i in range(len(a)):
	b += a[i]
if b % 2 != 1:
	for i in range(1, len(a)):
		for n in range(i + 1, len(a)):
			if b / 2 - a[0] - a[i] - a[n] == 0:
				k += 1
if k == 0:
	print('NO')
else:
	print('YES')


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')


def gen(prefix):
	if len(prefix) == 6:
		if prefix.count('1') == 3:
			s = 0
			for i in range(6):
				if prefix[i] == '1':
					s += a[i]
			if s * 2 == sum(a):
				print('YES')
				exit()
	else:
		gen(prefix + '0')
		gen(prefix + '1')
a = list(map(int, input().split()))
gen('')
print('NO')


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


i = [int(k) for k in input().split(' ') if k]
used = [0 for _ in range(len(i))]
for a in range(len(i)):
	used[a] = 1
	for b in range(len(i)):
		if used[b]:
			continue
		used[b] = 1
		for c in range(len(i)):
			if used[c]:
				continue
			used[c] = 1
			for d in range(len(i)):
				if used[d]:
					continue
				used[d] = 1
				for e in range(len(i)):
					if used[e]:
						continue
					used[e] = 1
					for f in range(len(i)):
						if used[f]:
							continue
						used[f] = 1
						if i[a] + i[b] + i[c] == i[d] + i[e] + i[f]:
							print('YES')
							exit()
						used[f] = 0
					used[e] = 0
				used[d] = 0
			used[c] = 0
		used[b] = 0
	used[a] = 0
print('NO')


data = list(map(int, input().split()))
s = sum(data)
if s % 2 == 1:
	print('no')
else:
	ans = False
	for i in range(1, 5):
		for j in range(i + 1, 6):
			if data[0] + data[i] + data[j] == s // 2:
				ans = True
	if ans:
		print('yes')
	else:
		print('no')


a = list(map(int, input().split()))
f = 0
for i in range(5):
	for j in range(5):
		if i != j:
			k = 0
			for g in a:
				k += g
			if a[i] + a[j] + a[5] == k - a[j] - a[i] - a[5]:
				f = 1
				break
if f == 1:
	print('YES')
else:
	print('NO')


a = input().split()
sum = 0
flag = False
for i in range(len(a)):
	sum += int(a[i])
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		for k in range(j + 1, len(a)):
			if int(a[i]) + int(a[j]) + int(a[k]) == sum / 2:
				flag = True
if flag:
	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')
			exit(0)
	print('NO')


import sys
a = list(map(int, input().split()))
need = sum(a)
if need % 2:
	print('NO')
	exit(0)
else:
	need //= 2

def rec(k, w, n):
	if w == need and n == 3:
		return 1
	if k >= len(a):
		return 0
	return max(rec(k + 1, w + a[k], n + 1), rec(k + 1, w, n))
if rec(0, 0, 0):
	print('YES')
else:
	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')


from collections import Counter
used = Counter()
arr = [int(i) for i in input().split()]
indexes = []

def permute():
	if len(indexes) == 3:
		sum1 = 0
		sum2 = 0
		for i in range(6):
			if used[i]:
				sum1 += arr[i]
			else:
				sum2 += arr[i]
		if sum1 == sum2:
			print('YES')
			exit()
		return
	for i in range(6):
		if not used[i]:
			indexes.append(i)
			used[i] += 1
			permute()
			indexes.pop()
			used[i] -= 1
permute()
print('NO')


arr = list(map(int, input().split()))
summ = sum(arr) / 2
fl = False
for i1 in range(6):
	for i2 in range(6):
		for i3 in range(6):
			for i4 in range(6):
				for i5 in range(6):
					for i6 in range(6):
						if i1 != i2 and i1 != i3 and (i1 != i4) and (i1 != i5) and (i1 != i6) and (i2 != i3) and (i2 != i4) and (i2 != i5) and (i2 != i6) and (i3 != i4) and (i3 != i5) and (i3 != i6) and (i4 != i5) and (i4 != i6) and (i5 != i6) and (arr[i1] + arr[i2] + arr[i3] == arr[i4] + arr[i5] + arr[i6]):
							fl = True
if fl:
	print('YES')
else:
	print('NO')


a = [int(i) for i in input().split()]
b = False
for i in range(6):
	for j in range(6):
		if j == i:
			continue
		for k in range(6):
			if k == j or k == i:
				continue
			c = a.copy()
			c.remove(a[k])
			c.remove(a[i])
			c.remove(a[j])
			if a[k] + a[i] + a[j] == sum(c):
				b = True
if b:
	print('YES')
else:
	print('NO')


from itertools import combinations
scores = [int(n) for n in input().split()]
total = sum(scores)
result = False
for t in combinations(scores, 3):
	if 2 * sum(t) == total:
		result = True
print('YES' if result else 'NO')


(*l,) = map(int, input().split())
ss = sum(l)
for i in range(64):
	if sum(map(int, bin(i)[2:])) == 3:
		s1 = sum((l[j] * bool(i & 1 << j) for j in range(6)))
		if ss - s1 == s1:
			print('YES')
			exit()
print('NO')


a = list(map(int, input().split()))
m = sum(a)
if m % 2 == 0:
	m = m // 2
	for i in range(len(a)):
		s = a[i]
		for j in range(len(a)):
			s = a[i]
			if j == i:
				continue
			if s + a[j] <= m:
				s += a[j]
				for k in range(len(a)):
					if k == i or k == j:
						continue
					if s + a[k] == m:
						print('YES')
						exit(0)
print('NO')


import itertools
a = list(map(int, input().split()))
s = sum(a)
ans = 'NO'
for i in itertools.combinations(a, 3):
	if sum(i) * 2 == s:
		ans = 'YES'
		break
print(ans)


(a1, a2, a3, a4, a5, a6) = map(int, input().split())
if a1 + a2 + a3 == a4 + a5 + a6 or a1 + a2 + a4 == a3 + a5 + a6 or a1 + a2 + a5 == a4 + a3 + a6 or (a1 + a2 + a6 == a4 + a5 + a3) or (a4 + a2 + a3 == a1 + a5 + a6) or (a5 + a2 + a3 == a4 + a1 + a6) or (a6 + a2 + a3 == a4 + a5 + a1) or (a1 + a4 + a3 == a2 + a5 + a6) or (a1 + a5 + a3 == a4 + a2 + a6) or (a1 + a6 + a3 == a4 + a5 + a2) or (a1 + a4 + a5 == a2 + a3 + a6) or (a1 + a5 + a6 == a4 + a2 + a3) or (a1 + a4 + a6 == a2 + a5 + a3) or (a4 + a2 + a5 == a1 + a6 + a3) or (a2 + a5 + a6 == a1 + a3 + a4) or (a2 + a4 + a6 == a1 + a3 + a5) or (a3 + a4 + a5 == a1 + a2 + a6) or (a3 + a5 + a6 == a1 + a2 + a4) or (a3 + a4 + a6 == a1 + a2 + a5):
	print('YES')
else:
	print('NO')


from itertools import permutations
a = [int(x) for x in input().split()]
check = False
for p in permutations(a):
	if sum(p[:3]) == sum(p[3:]):
		check = True
		break
if check:
	print('YES')
else:
	print('NO')


from itertools import permutations
a = list(map(int, input().split()))
if sum(a) % 2 == 1:
	print('No')
else:
	s = sum(a) // 2
	for i in set(permutations(a)):
		if sum(i[:3]) == s:
			print('Yes')
			break
	else:
		print('No')


scores = list(map(int, input().split()))
total = sum(scores)
foundSolution = 'NO'
for i in range(1, 5):
	for j in range(i + 1, 6):
		if 2 * (scores[0] + scores[i] + scores[j]) == total:
			foundSolution = 'YES'
			break
print(foundSolution)


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')


def get_value(a, arr):
	sum = 0
	i = 0
	while i < 6:
		if i in arr:
			i += 1
			continue
		else:
			sum += a[i]
			i += 1
	return sum
a = [int(elem) for elem in input().split()]
n1 = 0
n2 = 0
arr = []
sum1 = 0
sum2 = 0
exit = False
for i in range(4):
	arr.append(i)
	sum1 += a[i]
	for j in range(i + 1, 5):
		sum1 += a[j]
		arr.append(j)
		for z in range(j + 1, 6):
			arr.append(z)
			sum1 += a[z]
			sum2 = get_value(a, arr)
			if sum1 == sum2:
				print('YES')
				exit = True
				break
			arr = arr[:2]
			sum1 -= a[z]
		if exit == True:
			break
		arr = arr[:1]
		sum1 -= a[j]
	arr = []
	if exit == True:
		break
	sum1 -= a[i]
else:
	print('NO')


a = list(map(int, input().split()))
s = a[0] + a[1] + a[2] + a[3] + a[4] + a[5]
s1 = 0
s2 = s - s1
status = False
for i in range(4):
	for j in range(i + 1, 5):
		for k in range(j + 1, 6):
			s1 = a[i] + a[j] + a[k]
			s2 = s - s1
			if s1 == s2:
				print('YES')
				status = True
				break
		if status == True:
			break
	if status == True:
		break
if status != True:
	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')


ls = [int(i) for i in input().split()]
flag = 0
if ls[0] + ls[1] + ls[2] == ls[3] + ls[4] + ls[5]:
	flag = 1
if ls[0] + ls[1] + ls[3] == ls[2] + ls[4] + ls[5]:
	flag = 1
if ls[0] + ls[1] + ls[4] == ls[2] + ls[3] + ls[5]:
	flag = 1
if ls[0] + ls[1] + ls[5] == ls[2] + ls[3] + ls[4]:
	flag = 1
if ls[0] + ls[2] + ls[3] == ls[1] + ls[4] + ls[5]:
	flag = 1
if ls[0] + ls[2] + ls[4] == ls[1] + ls[3] + ls[5]:
	flag = 1
if ls[0] + ls[2] + ls[5] == ls[1] + ls[3] + ls[4]:
	flag = 1
if ls[0] + ls[3] + ls[4] == ls[1] + ls[2] + ls[5]:
	flag = 1
if ls[0] + ls[3] + ls[5] == ls[1] + ls[2] + ls[4]:
	flag = 1
if ls[0] + ls[4] + ls[5] == ls[1] + ls[2] + ls[3]:
	flag = 1
if flag == 0:
	print('NO')
else:
	print('YES')


l = tuple(map(int, input().split()))
su = sum(l)
if su % 2 != 0:
	print('NO')
else:
	su //= 2
	b = False
	for i in range(6):
		for j in range(6):
			if i == j:
				break
			for h in range(6):
				if h == i or h == j:
					break
				b = l[i] + l[j] + l[h] == su
				if b:
					print('YES')
					break
			if b:
				break
		if b:
			break
	else:
		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
for i in range(4):
	for j in range(i + 1, 5):
		for k in range(j + 1, 6):
			s1 = n[i] + n[j] + n[k]
			if s1 == sum / 2:
				print('YES')
				exit()
print('NO')


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')


a = [int(x) for x in input().split()]
d = sum(a) / 2
f = False
for i in range(6):
	for j in range(6):
		if j == i:
			continue
		for c in range(6):
			if c == j or c == i:
				continue
			if a[i] + a[j] + a[c] == d:
				f = True
if f:
	print('YES')
else:
	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')


a = [int(i) for i in input().split()]
b = sum(a)
s = False
if b % 2 == 0:
	b = b // 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:
					s = True
					break
if s:
	print('YES')
else:
	print('NO')


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')


a = list(map(int, input().split()))
c = 0
s = sum(a)
l = len(a)
if s % 2 == 0:
	for i in range(l):
		for j in range(l):
			for k in range(l):
				if (i != j and j != k and (i != k)) and a[i] + a[j] + a[k] == s / 2:
					c += 1
					break
	if c > 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


l = tuple(map(int, input().split()))
for i1 in range(6):
	for i2 in range(6):
		for i3 in range(6):
			if i1 != i2 and i2 != i3 and (i1 != i3):
				temp = (i1, i2, i3)
				sm = l[i1] + l[i2] + l[i3]
				for j1 in range(6):
					for j2 in range(6):
						for j3 in range(6):
							if j1 not in temp and j2 not in temp and (j3 not in temp) and (j1 != j2) and (j2 != j3) and (j1 != j3):
								sm2 = l[j1] + l[j2] + l[j3]
								if sm == sm2:
									print('YES')
									exit()
print('NO')


scores = list(map(int, input().split()))
sum = (scores[0] + scores[1] + scores[2] + scores[3] + scores[4] + scores[5]) / 2
num1 = max(scores)
scores.remove(num1)
yes = 0
if num1 <= sum:
	for i in range(5):
		for a in range(5):
			if i != a:
				if sum - num1 == scores[i] + scores[a]:
					yes = 1
					break
if yes == 1:
	print('YES')
else:
	print('NO')


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


a = list(map(int, input().split()))
c = 'NO'
q = 0
for u in range(len(a)):
	q += a[u]
for i in range(0, 6):
	for j in range(len(a)):
		for k in range(len(a)):
			if i != k and i != j and (k != j):
				if a[i] + a[k] + a[j] == q / 2:
					c = 'YES'
					break
print(c)


a = [int(s) for s in input().split()]
s = a[0] + a[1] + a[2] + a[3] + a[4] + a[5]
for i in range(len(a)):
	for j in range(len(a)):
		for k in range(len(a)):
			if a[i] + a[j] + a[k] == s / 2 and (not (i == j or j == k or i == k)):
				print('YES')
				quit()
print('NO')


a = list(map(int, input().split()))
sum_to_make = sum(a) / 2
flag = 0
l = len(a)
for i in range(l):
	for j in range(i + 1, l):
		for k in a[j + 1:]:
			if a[i] + a[j] + k == sum_to_make:
				print('YES')
				flag = 1
				break
		if flag == 1:
			break
	if flag == 1:
		break
if flag == 0:
	print('NO')


r = lambda : list(map(int, input().split()))
arr = r()
arr.sort()
f = False
for i in range(0, len(arr)):
	for j in range(0, len(arr)):
		for k in range(0, len(arr)):
			if i != j != k != i:
				if arr[i] + arr[j] + arr[k] == sum(arr) / 2:
					f = True
					break
print('YES' if f else 'NO')


a = list(map(int, input().split()))
a.sort()
b = sum(a)
ans = 0
for i in range(6):
	for x in range(6):
		for z in range(6):
			if 2 * (a[i] + a[x] + a[z]) == b and i != x and (i != z) and (x != z):
				ans = 1
				break
if ans == 0:
	print('NO')
else:
	print('YES')


cost = [int(i) for i in input().split()]
F = sum(cost)
flag = False
for i in range(4):
	for j in range(i + 1, 5):
		for l in range(j + 1, 6):
			if cost[i] + cost[j] + cost[l] == F - cost[i] - cost[j] - cost[l]:
				flag = True
				break
if flag:
	print('YES')
else:
	print('NO')