You are playing a new computer game in which you have to fight monsters. In a dungeon you are trying to clear, you met three monsters; the first of them has $a$ health points, the second has $b$ health points, and the third has $c$.

To kill the monsters, you can use a cannon that, when fired, deals $1$ damage to the selected monster. Every $7$-th (i. e. shots with numbers $7$, $14$, $21$ etc.) cannon shot is enhanced and deals $1$ damage to all monsters, not just one of them. If some monster's current amount of health points is $0$, it can't be targeted by a regular shot and does not receive damage from an enhanced shot.

You want to pass the dungeon beautifully, i. e., kill all the monsters with the same enhanced shot (i. e. after some enhanced shot, the health points of each of the monsters should become equal to $0$ for the first time). Each shot must hit a monster, i. e. each shot deals damage to at least one monster.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

Each test case consists of a single line that contains three integers $a$, $b$ and $c$ ($1 \le a, b, c \le 10^8$) — the number of health points each monster has.


-----Output-----

For each test case, print YES if you can kill all the monsters with the same enhanced shot. Otherwise, print NO. You may print each letter in any case (for example, YES, Yes, yes, yEs will all be recognized as positive answer).


-----Examples-----

Input
3
3 2 4
1 1 1
10 1 7
Output
YES
NO
NO


-----Note-----

In the first test case, you can do as follows: $1$-th shot to the first monster, $2$-th shot to the second monster, $3$-th shot to the third monster, $4$-th shot to the first monster, $5$-th shot to the third monster, $6$-th shot to the third monster, and $7$-th enhanced shot will kill all the monsters.

In the second test case, you can't kill monsters with the same enhanced shot, because the total number of health points of monsters is $3$, and you will kill them in the first 3 shots.

Source: codeforces | Difficulty: EASY
Tags: Sorting

Mathematics


Solutions:
ans = []
for _ in range(int(input())):
	(c, b, a) = sorted(list(map(int, input().split())))
	if (a + b + c) % 9 != 0:
		ans.append('NO')
	elif (a + b) // 8 > c:
		ans.append('NO')
	else:
		ans.append('YES')
print('\n'.join(ans))


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 != 0:
		print('NO')
	elif min(a, b, c) >= (a + b + c) / 9:
		print('YES')
	else:
		print('NO')


def main(a, b, c):
	if (a + b + c) % 9 == 0:
		game_number = (a + b + c) // 9
		if min(a, b, c) >= game_number:
			return 'YES'
	return 'NO'
t = int(input())
ans = []
for i in range(t):
	(a, b, c) = map(int, input().split())
	ans.append(main(a, b, c))
for j in ans:
	print(j)


n = int(input())
n1 = []
for i in range(n):
	(a, b, c) = map(int, input().split())
	summa = a + b + c
	if summa % 9 == 0:
		summa = int(summa / 9)
		a -= summa
		b -= summa
		c -= summa
		if a >= 0 and b >= 0 and (c >= 0):
			n1 += ['YES']
		else:
			n1 += ['NO']
	else:
		n1 += ['NO']
for i in n1:
	print(i)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	mm = min(a, b, c)
	val = a + b + c
	if val % 9 != 0:
		print('NO')
	else:
		k = val // 9
		if k <= mm:
			print('YES')
		else:
			print('NO')


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

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

def FACT(n, mod):
	s = 1
	facts = [1]
	for i in range(1, n + 1):
		s *= i
		s %= mod
		facts.append(s)
	return facts[n]

def C(n, k, mod):
	return FACT(n, mod) * pow(FACT(k, mod) * FACT(n - k, mod) % mod, mod - 2, mod) % mod
t = II()
for q in range(t):
	(a, b, c) = MI()
	s = a + b + c
	if s % 9 == 0 and a >= s // 9 and (b >= s // 9) and (c >= s // 9):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	s = a + b + c - 3
	if s % 9 == 6 and a - 1 >= s // 9 and (b - 1 >= s // 9) and (c - 1 >= s // 9):
		print('YES')
	else:
		print('NO')


from pprint import pprint
import sys

def do():
	(a, b, c) = map(int, input().split())
	t = a + b + c
	x = t // 9
	if t % 9 == 0 and min(a, b, c) >= x:
		print('YES')
		return
	print('NO')
q = int(input())
for _ in range(q):
	do()


for _ in range(int(input())):
	lst = list(map(int, input().split()))
	if sum(lst) % 9 or sum(lst) // 9 > min(lst):
		print('no')
	else:
		print('yes')


from sys import stdin
q = int(input())

def f(m):
	d = m // 7
	d *= 2
	return d + m > su
for j in range(q):
	(a, b, c) = map(int, input().split())
	l = 0
	lox = min(a, b, c)
	su = a + b + c
	if su % 9 == 0:
		if su // 9 <= lox:
			print('YES')
			continue
	print('NO')


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_string():
	return list(map(str, sys.stdin.readline().strip().split()))

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

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')
from sys import maxsize

def solve():
	for _ in range(get_int()):
		arr = get_list()
		if sum(arr) % 9 != 0 or min(arr) < sum(arr) // 9:
			get_print('NO')
		else:
			get_print('YES')
solve()


tests = int(input())
hp = []
for i in range(0, tests):
	inp = input()
	nums = inp.split()
	hp.append(nums)
for array in hp:
	sum = 0
	Check = False
	for number in array:
		sum = sum + int(number)
	for number in array:
		if int(number) >= sum / 9:
			check = True
		else:
			check = False
			break
	if sum % 9 == 0 and check:
		print('YES')
	else:
		print('NO')


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from math import sqrt, pi, ceil, log, inf, gcd, floor
from itertools import combinations, permutations
from bisect import *
from fractions import Fraction
from heapq import *

def solve():
	a = list(map(int, input().split()))
	if sum(a) % 9 == 0:
		z = sum(a) // 9
		for i in a:
			if i < z:
				return 'NO'
		return 'YES'
	return 'NO'

def main():
	for _ in range(int(input())):
		print(solve())
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for k in range(int(input())):
	(a, b, c) = map(int, input().split())
	sm = a + b + c
	if sm % 9 == 0:
		n = sm // 9
		if a >= n and b >= n and (c >= n):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(map(int, input().split()))
	if sum(a) % 9 != 0 or min(a) < sum(a) // 9:
		print('NO')
	else:
		print('YES')


import sys
from collections import Counter
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

def solve(a, b, c):
	s = a + b + c
	if s % 9 == 0:
		if min(a, b, c) >= s // 9:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
for _ in range(inp()):
	(a, b, c) = invr()
	solve(a, b, c)


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	s1 = a + b
	s2 = b + c
	s3 = c + a
	if (a + b + c) % 9 == 0 and min(a, b, c) >= (a + b + c) // 9:
		print('YES')
	else:
		print('NO')


def op():
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	sum = a + b + c
	if sum % 9:
		print('NO')
	else:
		d = min(a, min((b, c)))
		if d < sum // 9:
			print('NO')
		else:
			print('YES')
t = int(input())
while t > 0:
	t = t - 1
	op()


from sys import stdin
for _ in range(int(stdin.readline())):
	a = list(map(int, stdin.readline().split()))
	s = sum(a)
	m = min(a)
	if s % 9 == 0 and m >= s // 9:
		print('YES')
	else:
		print('NO')


from os import path
from io import BytesIO, IOBase
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, Counter, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

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

def si():
	return input().rstrip()

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 998244353
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('0')
file = 1

def ceil(a, b):
	return (a + b - 1) // b

def solve():
	for _ in range(ii()):
		a = li()
		mnx = min(a)
		s = sum(a)
		x = s // 9
		s %= 9
		if x > mnx or s != 0:
			print('NO')
		else:
			print('YES')
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


import sys
read = sys.stdin.readline
for _ in range(int(read())):
	input_abc = list(map(int, read().split()))
	abc = sum(input_abc)
	if abc < 9:
		print('NO')
	elif abc == 9:
		print('YES')
	else:
		tmp = abc % 9
		tmp1 = abc // 9
		if tmp == 0:
			for x in input_abc:
				if x < tmp1:
					print('NO')
					break
			else:
				print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(a, b, c) = list(map(int, input().split()))
	if a + b + c < 9:
		print('NO')
	elif (a + b + c) % 9 == 0 and min([a, b, c]) >= (a + b + c) // 9:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	drag = list(map(int, input().split()))
	if sum(drag) % 9 == 0:
		if min(drag) >= sum(drag) // 9:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


T = int(input())
for i in range(T):
	arr = list(map(int, input().split()))
	if sum(arr) % 9 == 0:
		if min(arr) >= sum(arr) // 9:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def Solve():
	for t in range(int(input())):
		m = list(map(int, input().split()))
		sm = sum(m)
		mm = min(m)
		if sm % 9 == 0 and sm / 9 <= mm:
			print('YES')
		else:
			print('NO')
Solve()


t = int(input())
l = []
s = 0
n = t
while t:
	(a, b, c) = map(int, input().split())
	l.extend([a, b, c])
	t -= 1
i = 0
while n:
	s = l[i] + l[i + 1] + l[i + 2]
	k = s / 9
	if s % 9 == 0 and l[i] >= k and (l[i + 1] >= k) and (l[i + 2] >= k):
		print('YES')
	else:
		print('NO')
	i += 3
	n -= 1


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	k = min(a, b, c)
	s = a + b + c
	if s % 9 == 0 and k >= s // 9:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	tot = a + b + c
	if tot % 9 == 0:
		rem = tot // 9
		if a >= rem and b >= rem and (c >= rem):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	a = [int(x) for x in input().split(' ')]
	if sum(a) % 9:
		print('NO')
	else:
		k = round(sum(a) / 9)
		if a[0] >= k and a[1] >= k and (a[2] >= k):
			print('YES')
		else:
			print('NO')


tc = int(input())
for _ in range(tc):
	(a, b, c) = map(int, input().split())
	tmp = (a + b + c) // 9
	if tmp <= min(a, b, c) and (a + b + c) % 9 == 0:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

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

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

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

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def calmaxpow(n, i):
	f = 0
	while n % i == 0:
		n //= i
		f += 1
	return f
for xyz in range(0, int(input())):
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 == 0:
		r = (a + b + c) // 9
		if min(a, b, c) >= r:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = [int(x) for x in input().split()]
	mn = min(a, b, c)
	sm = a + b + c
	mn_shots = sm - 3 * mn
	if mn_shots // 6 <= mn and sm % 9 == 0:
		print('YES')
	else:
		print('NO')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(a, b, c) = map(int, sys.stdin.readline().split())
	(num_enhanced, rem) = divmod(a + b + c, 6 + 3)
	print('YES' if min(a, b, c) >= num_enhanced and rem == 0 else 'NO')


def dungeon(a, b, c):
	m = min(a, b, c)
	s = a + b + c
	f = s // 9
	if f > 0 and f <= m and (s % 9 == 0):
		return 'YES'
	return 'NO'
t = int(input())
final = []
for _ in range(t):
	(a, b, c) = map(int, input().split())
	final.append(dungeon(a, b, c))
for _ in range(t):
	print(final[_])


tcs = int(input())
for tc in range(tcs):
	li = list(map(int, input().split()))
	if sum(li) % 9 == 0 and min(li) >= sum(li) // 9:
		print('YES')
	else:
		print('NO')


count = int(input())
for i in range(count):
	(a, b, c) = input().split()
	if (int(a) + int(b) + int(c)) % 9 == 0 and min(int(a), int(b), int(c)) >= (int(a) + int(b) + int(c)) // 9:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(a, b, c) = map(int, input().split())
	val = min(a, b, c)
	rm1 = a // 9 + b // 9 + c // 9
	(a, b, c) = (a % 9, b % 9, c % 9)
	v = a + b + c
	rm = v // 7
	rm1 = rm + rm1
	v = v - 3 * rm
	if rm1 <= val and (v + rm) % 7 == 0:
		print('YES')
	else:
		print('NO')


test_cases = int(input())
health_tests = []
for n in range(test_cases):
	health = input().split()
	health_tests.append(health)
total = 0
for i in health_tests:
	ascend = sorted(map(int, i))
	for j in ascend:
		total = sum(ascend)
		if total % 9 == 0 and total // 9 <= ascend[0]:
			print('YES')
			break
		else:
			print('NO')
			break


t = int(input(' '))
for i in range(t):
	(a, b, c) = map(int, input().split(' '))
	k = a + b + c
	if k < 9:
		print('NO')
	elif k % 9 == 0:
		if a >= k // 9 and b >= k // 9 and (c >= k // 9):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


tests = int(input())
while tests > 0:
	(a, b, c) = list(map(int, input().split()))
	m = min(a, b, c)
	ans = 'NO'
	if (a + b + c) % 9 == 0:
		d = (a + b + c) / 9
		if m >= d:
			ans = 'YES'
	print(ans)
	tests -= 1


t = int(input())
for i in range(0, t):
	mlist = list(map(int, input().split()))
	s = sum(mlist)
	mini = min(mlist)
	c = 0
	if s % 9 == 0:
		if mini >= s // 9:
			c = 1
	if c == 0:
		print('NO')
	if c == 1:
		print('YES')


T = int(input())
for t in range(T):
	(a, b, c) = [int(i) for i in input().split()]
	total = a + b + c
	if total % 9 == 0:
		if a >= total // 9 and b >= total // 9 and (c >= total // 9):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def main():
	for t in range(int(input())):
		(a, b, c) = map(int, input().split())
		l = [a, b, c]
		summ = sum(l)
		l.sort()
		if summ % 9 != 0:
			print('NO')
		else:
			reiz = summ // 9
			if l[0] - reiz >= 0:
				print('YES')
			else:
				print('NO')
main()


tc = int(input())
while tc:
	(a, b, c) = map(int, input().split())
	tot = a + b + c
	if tot % 9 != 0:
		print('NO')
	else:
		r = tot // 9
		if a >= r and b >= r and (c >= r):
			print('YES')
		else:
			print('NO')
	tc -= 1


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	t = int(input())
	for _ in range(t):
		(a, b, c) = inar()
		if (a + b + c) % 9 == 0 and (a + b + c) // 9 <= min(a, b, c):
			print('YES')
		else:
			print('NO')
main()


from functools import reduce
for test in range(0, int(input())):
	(a, b, c) = list(map(int, input().split()))
	if (a + b + c) % 9:
		print('NO')
	else:
		print('YES' if min(a, b, c) >= (a + b + c) // 9 else 'NO')


def answer():
	s = x + y + z
	score = s
	if s // 9 <= min(x, y, z):
		s -= score // 9 * 3
		s -= score // 9 * 6
		if s == 0:
			return 'YES'
	return 'NO'
for T in range(int(input())):
	(x, y, z) = map(int, input().split())
	print(answer())


import sys
input = sys.stdin.readline

def solve():
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9:
		return 'NO'
	x = 7 * ((a + b + c) // 9)
	if min(a, b, c) - x // 7 < 0:
		return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(solve())


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 == 0:
		x = (a + b + c) // 9
		if a >= x and b >= x and (c >= x):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline()

def RL():
	return map(int, sys.stdin.readline().split())

def RLL():
	return list(map(int, sys.stdin.readline().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
import math
for _ in range(N()):
	(a, b, c) = RL()
	(s, m) = (sum([a, b, c]), min([a, b, c]))
	if s < 9:
		print('NO')
	else:
		t = s - m * 3
		if t % 3:
			print('NO')
		else:
			p = t // 6
			if m < p:
				print('NO')
			else:
				k = m - p
				if t % 6:
					k -= 2
				if k >= 0 and k % 3 == 0:
					print('YES')
				else:
					print('NO')


import sys

def fi():
	return sys.stdin.readline()
for _ in range(int(fi())):
	(a, b, c) = map(int, fi().split())
	if (a + b + c) % 9 == 0:
		m = (a + b + c) / 9
		if min(a, b, c) >= m:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	line = input().split(' ')
	a = int(line[0])
	b = int(line[1])
	c = int(line[2])
	if (a + b + c) % 9 == 0:
		r = (a + b + c) // 9
		if a < r or b < r or c < r:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
from queue import PriorityQueue as pq
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 == 0 and min(a, min(b, c)) >= (a + b + c) // 9:
		print('YES')
	else:
		print('NO')


import sys
input = iter(sys.stdin.read().splitlines()).__next__

def solve(a, b, c):
	total_health = a + b + c
	if total_health % 9 != 0:
		return False
	if total_health // 9 > min(a, b, c):
		return False
	return True
TC = int(input())
for tc in range(TC):
	(a, b, c) = map(int, input().split())
	res = solve(a, b, c)
	print('YES' if res else 'NO')


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split(' '))
	s = a + b + c
	d = s // 9
	if s > 8 and s % 9 == 0:
		if a >= d and b >= d and (c >= d):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for j in range(n):
	f = [int(a) for a in input().split()]
	s = sum(f)
	if s % 9 == 0:
		flag = True
		for i in f:
			if i < s // 9:
				flag = False
				break
	else:
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


from sys import stdout, stdin
input = stdin.readline
print = stdout.write

def main():
	mp = lambda : map(int, input().strip().split())
	it = int
	t = it(input())
	for _ in [0] * t:
		(a, b, c) = sorted(mp())
		s = a + b + c
		if s % 9 == 0 and a >= s // 9:
			print('yes\n')
		else:
			print('no\n')
main()


for _ in range(int(input())):
	n = list(map(int, input().split()))
	sum1 = sum(n)
	no = 0
	if sum1 < 9:
		print('NO')
	else:
		for i in n:
			if i < sum1 // 9:
				no = 1
		if no == 0:
			if sum1 % 9 == 0:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


import sys
import math
from collections import Counter, defaultdict
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()

def case():
	(a, b, c) = MAP()
	x = a + b + c
	if x % 9 == 0 and min(a, b, c) >= x // 9:
		print('YES')
	else:
		print('NO')
for _ in range(IN()):
	case()


import sys, os
from math import sqrt, gcd, ceil, log, floor
from math import factorial as fact
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
from itertools import permutations
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))
MOD = 10 ** 9 + 7

def main():
	ans = []
	for _ in range(int(input())):
		arr = read()
		m = min(arr)
		s = sum(arr)
		if s % 9 == 0 and m >= s // 9:
			ans.append('YES')
		else:
			ans.append('NO')
	print('\n'.join(ans))
main()


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa = ifa[::-1]

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return flag

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		seen.add(u)
		for (v, w) in graph[u]:
			if v not in d or d[v] > d[u] + w:
				d[v] = d[u] + w
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [[ch, len(list(g))] for (ch, g) in groupby(it)]

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None

def nb(i, j):
	for (ni, nj) in [[i + 1, j], [i - 1, j], [i, j - 1], [i, j + 1]]:
		if 0 <= ni < n and 0 <= nj < m:
			yield (ni, nj)

@bootstrap
def gdfs(r, p):
	if len(g[r]) == 1 and p != -1:
		yield None
	for ch in g[r]:
		if ch != p:
			yield gdfs(ch, r)
	yield None
t = N()
for i in range(t):
	(a, b, c) = RL()
	s = a + b + c
	if s % 9:
		ans = False
	else:
		s = s // 9
		if min(a, b, c) >= s:
			ans = True
		else:
			ans = False
	ans = 'YES' if ans else 'NO'
	print(ans)


n = int(input())
for i in range(n):
	r = list(map(int, input().split(' ')))
	l = 0
	for i in range(len(r)):
		l = l + r[i]
	if l % 9 == 0:
		k = int(l / 9)
		s = 0
		for i in range(len(r)):
			if r[i] < k:
				s = s + 1
		if s > 0:
			print('no')
		else:
			print('yes')
	else:
		print('no')


for s in [*open(0)][1:]:
	l = [*map(int, s.split())]
	print('YNEOS'[sum(l) % 9 > 0 or min(l) * 9 < sum(l)::2])
num_inp = lambda : int(input())
arr_inp = lambda : list(map(int, input().split()))
sp_inp = lambda : map(int, input().split())
str_inp = lambda : input()


from sys import stdin, stdout
q = int(input())
for k in range(q):
	(x, y, z) = list(map(int, stdin.readline().split()))
	d = x + y + z
	rem = (x + y + z) // 9
	if (x + y + z) % 9 == 0 and x >= rem and (y >= rem) and (z >= rem):
		print('Yes')
	else:
		print('No')


T = [[int(a) for a in input().split()] for i in range(int(input()))]
for t in T:
	print('YES' if sum(t) % 9 == 0 and min(t) >= sum(t) / 9 else 'NO')


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	low = a
	if b < low:
		low = b
	if c < low:
		low = c
	tot = a + b + c
	if tot % 9 != 0:
		print('NO')
		continue
	if low < tot // 9:
		print('NO')
		continue
	print('YES')


from sys import stdin
input = stdin.readline
for _ in ' ' * int(input()):
	(a, b, c) = map(int, input().split())
	s = a + b + c
	if s % 9 == 0:
		k = s // 9
		if a >= k and b >= k and (c >= k):
			print('YES')
			continue
	print('NO')


n = int(input())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
for i in range(n):
	if sum(a[i]) % 9 == 0 and a[i][0] >= sum(a[i]) // 9 and (a[i][1] >= sum(a[i]) // 9) and (a[i][2] >= sum(a[i]) // 9):
		print('YES')
	else:
		print('NO')


def solve():
	(a, b, c) = sorted(list(map(int, input().strip().split())))
	k = (a + b + c) // 9
	if (a + b + c) % 9 or a < k:
		print('NO')
	else:
		print('YES')
t = int(input().strip())
for _ in range(t):
	solve()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	w = list(map(int, input().split()))
	s = sum(w)
	a = 7 + len(w) - 1
	if s % a == 0 and min(w) >= s // a:
		print('YES')
	else:
		print('NO')


def read_ints():
	return map(int, input().split())
(t_n,) = read_ints()
for i_t in range(t_n):
	(a, b, c) = read_ints()
	min_hp = min(a, b, c)
	odd = a + b + c - 3 * min_hp
	del a, b, c
	if odd > 0:
		powerful_shots_n = (odd - 1) // 6
		min_hp -= powerful_shots_n
		next_shot_index_mod_7 = (odd + powerful_shots_n) % 7
	else:
		next_shot_index_mod_7 = 0
	del odd
	hp = min_hp
	result = (hp > 0 or (hp == 0 and next_shot_index_mod_7 == 0)) and next_shot_index_mod_7 in (0, 3, 6) and ((min_hp - (6 - next_shot_index_mod_7) // 3) % 3 == 1)
	if result:
		print('YES')
	else:
		print('NO')


tests = int(input())
for i in range(tests):
	linha = list(map(int, input().split()))
	soma = 0
	acabo = 0
	for j in linha:
		soma += j
	menos = round(soma / 9)
	if menos > soma / 9:
		menos -= 1
	menos = max(0, menos - 1)
	for j in range(3):
		if linha[j] <= menos and acabo == 0:
			acabo = 1
			print('NO')
	if soma % 9 == 0 and acabo == 0:
		print('YES')
	elif acabo == 0:
		print('NO')


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	if sum(l) % 9 != 0:
		print('NO')
	elif sum(l) // 9 > min(l):
		print('NO')
	else:
		print('YES')


n = int(input(''))
anslist = []
for i in range(n):
	monlist = [int(num) for num in input('').split()]
	if sum(monlist) % 9 == 0:
		if min(monlist) >= sum(monlist) / 9:
			anslist.append('YES')
		else:
			anslist.append('NO')
	else:
		anslist.append('NO')
for j in anslist:
	print(j)


def checker(a, b, c):
	s = a + b + c
	if s % 9 != 0:
		return False
	else:
		n = s // 9
		if a < n:
			return False
		elif b < n:
			return False
		elif c < n:
			return False
		else:
			return True

def check(a, b, c):
	y = checker(a, b, c)
	if y == True:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	x = [int(x) for x in input().split()]
	check(x[0], x[1], x[2])


for k in range(int(input())):
	l = list(map(int, input().split()))
	p = sum(l)
	if p % 9 == 0 and min(l) >= p // 9 and (0 not in l):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	(a, b, c) = reversed(sorted([a, b, c]))
	l = a + b + c - 3
	if c - 1 < l // 9 or l % 9 != 6:
		print('NO')
	else:
		print('YES')


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split(' '))
	aoe_time = min(a, b, c)
	is_aoe = False
	if (a + b + c) % 9 == 0 and (a + b + c) / 9 <= aoe_time:
		is_aoe = True
	if is_aoe:
		print('YES')
	else:
		print('NO')


import sys

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

def read_int():
	return int(sys.stdin.readline().strip())

def read_ints():
	return map(int, sys.stdin.readline().strip().split())

def read_str_split():
	return list(sys.stdin.readline().strip())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def Main():
	monster = read_int_list()
	total = sum(monster)
	if total % 9:
		return 'No'
	if any([i < total // 9 for i in monster]):
		return 'No'
	return 'Yes'
for _ in range(int(input())):
	print(Main())


T = int(input())
ans = []
for t in range(T):
	(a, b, c) = map(int, input().split())
	al = a + b + c
	if al % 9 != 0:
		ans.append('NO')
		continue
	if al // 9 > min(a, b, c):
		ans.append('NO')
		continue
	ans.append('YES')
for t in range(T):
	print(ans[t])


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print('NO' if (a + b + c) % 9 or min(a, b, c) < (a + b + c) // 9 else 'YES')


num = int(input())
lst = []
for i in range(num):
	ints = input()
	ints = ints.split()
	for k in range(3):
		ints[k] = int(ints[k])
	summ = sum(ints)
	if summ % 9 == 0:
		a = summ / 9
		for k in range(3):
			if ints[k] - a < 0:
				lst.append('NO')
				break
			if k == 2:
				lst.append('YES')
	else:
		lst.append('NO')
for i in range(num):
	print(lst[i])


from sys import stdin
for _ in range(int(input())):
	(a, b, c) = [int(i) for i in stdin.readline().split()]
	n = a + b + c
	m = min(a, b, c)
	if n % 9 == 0 and n // 9 <= m:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	if sum(a) < 9:
		print('NO')
	elif sum(a) % 9 == 0 and a[2] >= sum(a) // 9:
		print('YES')
	else:
		print('NO')


def solve():
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 == 0 and min(a, b, c) >= (a + b + c) // 9:
		print('YES')
	else:
		print('NO')
for testis in range(int(input())):
	solve()


t = int(input())
out = []
for x in range(t):
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	mini = (a + b + c) / 9
	if a >= mini and b >= mini and (c >= mini):
		if (a + b + c) % 9 == 0:
			out.append('YES')
		else:
			out.append('NO')
	else:
		out.append('NO')
for x in range(t):
	print(out[x])


t = int(input())
for counter in range(t):
	ans = 'NO'
	health = [int(x) for x in input().split()]
	if sum(health) % 9 == 0 and min(health) >= sum(health) // 9:
		ans = 'YES'
	print(ans)


list_ans = []
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	s = a + b + c
	if s % 9 == 0 and min(a, b, c) >= s // 9:
		list_ans.append('YES')
	else:
		list_ans.append('NO')
for item in list_ans:
	print(item)


t = int(input())
while t:
	t -= 1
	(a, b, c) = list(map(int, input().split()))
	s = a + b + c
	if s < 9 or s % 9 != 0:
		print('NO')
	elif min(a, b, c) < s // 9:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	summa = a + b + c
	possible = False
	if summa % 9 == 0:
		round_count = summa / 9
		if a >= round_count and b >= round_count and (c >= round_count):
			possible = True
	print('YES') if possible else print('NO')


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for i in range(t):
		(a, b, c) = map(int, input().split())
		s = a + b + c
		if s % 9 == 0 and min(a, b, c) >= s // 9:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
ans = ''
for _ in range(t):
	abc = [int(i) for i in input().split()]
	a = abc[0]
	b = abc[1]
	c = abc[2]
	s = a + b + c
	if s % 9 != 0:
		ans += 'NO \n'
	else:
		k = s // 9
		if min(a, b, c) < k:
			ans += 'NO \n'
		else:
			ans += 'YES \n'
print(ans)


t = int(input())
for z in range(t):
	(a, b, c) = map(int, input().split())
	d = a + b + c
	if d % 9 == 0 and min(a, b, c) >= d // 9:
		print('YES')
	else:
		print('NO')


a = int(input())
for _ in range(a):
	(x, y, z) = map(int, input().split())
	if x + y + z >= 9 and (x + y + z) % 9 == 0 and ((x + y + z) // 9 <= x) and ((x + y + z) // 9 <= y) and ((x + y + z) // 9 <= z):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c) = tuple(map(int, input().split()))
	s = a + b + c
	if s % 9 != 0:
		print('NO')
	else:
		ef = s / 9
		if min(a, b, c) < ef:
			print('NO')
		else:
			print('YES')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	i = 1
	s = a + b + c
	m = min(a, b, c)
	if s % 9 == 0 and s / 9 <= m:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline

def read_number():
	return int(input())

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

def read_string():
	s = input()
	return list(s[:len(s) - 1])

def read_separated_numbers():
	return map(int, input().split())
n = read_number()
for i in range(n):
	input_list = read_list()
	total_health = sum(input_list)
	if total_health % 9 != 0:
		min_no_of_circles = total_health // 9 + 1
	else:
		min_no_of_circles = total_health / 9
	if total_health < 7:
		print('NO')
		continue
	if total_health % 9 != 0:
		print('NO')
		continue
	if min(input_list) < min_no_of_circles:
		print('NO')
		continue
	print('YES')


t = int(input())
for tc in range(t):
	l = list(map(int, input().split()))
	s = sum(l)
	if s % 9 == 0 and s // 9 <= min(l):
		print('YES')
	else:
		print('NO')


t = int(input())
results = []
for i in range(t):
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	if (a + b + c) % 9 == 0:
		if min(a, b, c) >= (a + b + c) // 9:
			results.append('YES')
		else:
			results.append('NO')
	else:
		results.append('NO')
for i in range(t):
	print(results[i])


for _ in range(int(input())):
	arr = input().split(' ')
	arr = [int(i) for i in arr]
	if sum(arr) % (len(arr) + 6) == 0 and min(arr) >= sum(arr) // (len(arr) + 6):
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 != 0:
		print('NO')
	else:
		print('YES' if min(a, b, c) >= (a + b + c) // 9 else 'NO')
	t -= 1


for s in [*open(0)][1:]:
	a = (*map(int, s.split()),)
	s = sum(a)
	print('YNEOS'[0 < s % 9 or s > 9 * min(a)::2])


for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 != 0:
		print('NO')
	else:
		sm = (a + b + c) // 9
		if a < sm or b < sm or c < sm:
			print('NO')
		else:
			print('YES')


N = int(input())
for i in range(N):
	(A, B, C) = map(int, input().split())
	sum1 = A + B + C
	mok = int(sum1 / 9)
	if sum1 % 9 == 0 and A >= mok and (B >= mok) and (C >= mok):
		print('YES')
	else:
		print('NO')


test_cases = int(input())
res = []
for test in range(test_cases):
	st = input()
	ls = st.split()
	i_list = []
	sm = 0
	mn = int(ls[0])
	for value in ls:
		i_list.append(int(value))
		sm += i_list[-1]
		if i_list[-1] < mn:
			mn = i_list[-1]
	if sm % 9 == 0 and sm // 9 <= mn:
		res.append('YES')
	else:
		res.append('NO')
for value in res:
	print(value)


for _ in range(int(input())):
	l = list(map(int, input().split()))
	if sum(l) % 9 == 0 and sum(l) // 9 <= min(l):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(0, n):
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 == 0:
		if (a + b + c) / 9 <= min(a, b, c):
			print('Yes')
		else:
			print('No')
	else:
		print('No')


import math
from collections import defaultdict
from sys import stdin
input = stdin.readline
T = int(input())
for _ in range(T):
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 == 0 and (a + b + c) // 9 <= min(a, b, c):
		print('YES')
		continue
	print('NO')


t = int(input())
ans = []
for i in range(t):
	(a, b, c) = [int(x) for x in input().split()]
	k = (a + b + c) / 9
	km = (a + b + c) % 9
	if km != 0:
		ans.append('NO')
	elif a < k or b < k or c < k:
		ans.append('NO')
	else:
		ans.append('YES')
for i in ans:
	print(i)


for _ in 'A' * int(input()):
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 or min(a, b, c) < (a + b + c) // 9:
		print('NO')
	else:
		print('Yes')


import math
for i in range(0, int(input())):
	(a, b, c) = map(int, input().split())
	sum = a + b + c
	count = sum // 9
	flag = 0
	if (a < count) | (b < count) | (c < count):
		flag = 1
	if sum != count * 9:
		flag = 1
	if flag:
		print('NO')
	else:
		print('YES')


t = int(input())
for p in range(t):
	(a, b, c) = map(int, input().split())
	cur = a + b + c
	m = min(a, b, c)
	if cur % 9 != 0:
		print('NO')
	elif m >= cur / 9:
		print('YES')
	else:
		print('NO')


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input()))
(t,) = I()
for t1 in range(t):
	a = I()
	if sum(a) % 9 == 0:
		if min(a) >= int(sum(a) / 9):
			print('yes')
		else:
			print('no')
	else:
		print('no')


t = int(input())
triplas = []
for i in range(t):
	terna = [int(j) for j in input().split()]
	triplas.append(terna)
for i in range(t):
	triplas[i].sort()
	suma = triplas[i][0] + triplas[i][1] + triplas[i][2]
	if suma % 9 == 0 and triplas[i][0] / suma >= 1 / 9:
		print('YES')
	else:
		print('NO')


import os
from sys import stdin, stdout

def solve(tc):
	(a, b, c) = map(int, stdin.readline().split())
	tot = a + b + c
	if tot % 9:
		print('NO')
		return
	mini = min(min(a, b), c)
	if mini < tot // 9:
		print('NO')
		return
	print('YES')
tcs = 1
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


T = int(input())
for n in range(T):
	(a, b, c) = [int(x) for x in input().split()]
	temp = [a, b, c]
	k = (a + b + c) / 9
	if (a + b + c) % 9 != 0 or min(temp) < k:
		print('No')
	else:
		print('Yes')


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 == 0 and min([a, b, c]) >= (a + b + c) // 9:
		print('yes')
	else:
		print('no')


m = [list(map(int, input().split())) for i in range(int(input()))]
for i in m:
	print('YES' if sum(i) % 9 == 0 and min(i) >= sum(i) // 9 else 'NO')


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import Counter
from pprint import pprint
from itertools import permutations

def main():
	(a, b, c) = map(int, input().split())
	for r in range(7):
		if (7 * (a + b + c) + 2 * r) % 9 == 0:
			x = (7 * (a + b + c) + 2 * r) // 9
			if x % 7 == 0 and min(a, b, c) >= x // 7:
				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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	main()


n = int(input())
for i in range(n):
	s = list(map(int, input().split()))
	d = sum(s)
	if min(s) >= d // 9 and d % 9 == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	s = a + b + c
	r = s // 9
	l = [a, b, c]
	l.sort()
	if l[0] < r or l[1] < r or l[2] < r:
		print('NO')
	elif (a + b + c) % 9 == 0:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	total = a + b + c
	if total % 9 == 0 and min(a, b, c) > (total - 1) // 9:
		print('YES')
	else:
		print('NO')


fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from re import *
from sys import *
from math import *
from heapq import *
from queue import *
from bisect import *
from string import *
from itertools import *
from collections import *
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from collections import Counter as cc
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = 1
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)

def output(answer):
	stdout.write(str(answer))
num = int(z())
for _ in range(num):
	(a, b, c) = szzz()
	if (a + b + c) % 9 == 0 and a >= (a + b + c) // 9:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	x = a + b + c
	print('Yes' if x % 9 == 0 and min(a, b, c) >= x // 9 else 'No')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, c) = [*map(int, input().split())]
	n = a + b + c
	x = n // 9
	y = n % 9
	if y == 0 and min(a, b, c) >= x:
		print('YES')
	else:
		print('NO')


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	(a, b, c) = f()
	ans = [a, b, c]
	ls = sum(ans)
	lp = min(ans)
	if ls % 9 == 0 and lp * 9 >= ls or ls == 9:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	k = (a + b + c) / 9
	if k // 1 - k == 0:
		if a < k or b < k or c < k:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
for ti in range(t):
	(a1, b1, c1) = map(int, input().split())
	a = min(a1, b1, c1)
	c = max(a1, b1, c1)
	b = a1 + b1 + c1 - a - c
	n = (a + b + c) // 9
	ans = 'NO'
	if (a + b + c) % 9 == 0:
		if a >= n:
			ans = 'YES'
	print(ans)


test = int(input())
while test > 0:
	(a, b, c) = map(int, input().split())
	m = min(a, b, c)
	if (a + b + c) % 9 == 0 and m >= (a + b + c) // 9:
		print('YES')
	else:
		print('NO')
	test -= 1


import sys, os, io
input = sys.stdin.readline
T = int(input())
ans = ['NO'] * T
for t in range(T):
	(a, b, c) = map(int, input().split())
	if (a + b + c) % 9 == 0 and min([a, b, c]) >= (a + b + c) // 9:
		ans[t] = 'YES'
print(*ans, sep='\n')


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	s = a + b + c
	if s % 9 == 0:
		mini = s // 9
		if a >= mini and b >= mini and (c >= mini):
			print('YES')
			continue
	print('NO')


rows = int(input())
list_rows = []
for i in range(rows):
	singline = input()
	list_rows.append(singline)
for item in list_rows:
	intlines = item.split()
	intlines = [int(i) for i in intlines]
	su_m = 0
	for item1 in intlines:
		su_m = su_m + item1
	su_m = su_m - 3
	miin = min(intlines)
	s = (su_m + 3) / 9
	if s - int(s) == 0 and miin >= s:
		print('YES')
	else:
		print('NO')