You are given two integers $a$ and $b$. You may perform any number of operations on them (possibly zero).

During each operation you should choose any positive integer $x$ and set $a := a - x$, $b := b - 2x$ or $a := a - 2x$, $b := b - x$. Note that you may choose different values of $x$ in different operations.

Is it possible to make $a$ and $b$ equal to $0$ simultaneously?

Your program should answer $t$ independent test cases.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 100$) — the number of test cases.

Then the test cases follow, each test case is represented by one line containing two integers $a$ and $b$ for this test case ($0 \le a, b \le 10^9$).


-----Output-----

For each test case print the answer to it — YES if it is possible to make $a$ and $b$ equal to $0$ simultaneously, and NO otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).


-----Example-----
Input
3
6 9
1 1
1 2

Output
YES
NO
YES



-----Note-----

In the first test case of the example two operations can be used to make both $a$ and $b$ equal to zero:  choose $x = 4$ and set $a := a - x$, $b := b - 2x$. Then $a = 6 - 4 = 2$, $b = 9 - 8 = 1$;  choose $x = 1$ and set $a := a - 2x$, $b := b - x$. Then $a = 2 - 2 = 0$, $b = 1 - 1 = 0$.

Difficulty: EASY

Solutions:
def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	z = 2 * min(a, b) - max(a, b)
	if z < 0:
		print('NO')
	elif z % 3 == 0:
		print('YES')
	else:
		print('NO')


import sys
reader = (map(int, s.split()) for s in sys.stdin)
(t,) = next(reader)
for _ in range(t):
	(a, b) = next(reader)
	cond = 2 * a >= b and 2 * b >= a and (not (a + b) % 3)
	print('YES' if cond else 'NO')


from sys import stdin

def solve():
	for _ in range(int(stdin.readline())):
		(a, b) = map(int, stdin.readline().split())
		a1 = min(a, b)
		b1 = max(a, b)
		k = 2 * b1 - a1
		if k % 3 == 0:
			if a1 - k // 3 >= 0 and b1 - 2 * (k // 3) >= 0:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
solve()


n = int(input())
results = []
for i in range(n):
	vals = input().split()
	a = int(vals[0])
	b = int(vals[1])
	x = 2 * a - b
	y = 2 * b - a
	if x % 3 == 0 and y % 3 == 0 and (x >= 0) and (y >= 0):
		results.append('YES')
	else:
		results.append('NO')
for result in results:
	print(result)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == b:
		print('YES' if a % 3 == 0 else 'NO')
		continue
	if a < b:
		(a, b) = (b, a)
	x = a - b
	if a - 2 * x >= 0 and b - x >= 0 and ((b - x) % 3 == 0):
		print('YES')
	else:
		print('NO')


def main():
	t = int(input())
	for __ in range(t):
		(a, b) = map(int, input().split())
		if a > b:
			(a, b) = (b, a)
		if (a + b) % 3 == 0 and 2 * a >= b:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for test in range(t):
	(a, b) = map(int, input().split())
	t = a
	a = max(a, b)
	b = min(t, b)
	if (a + b) % 3 == 0 and a <= 2 * b:
		print('YES')
		continue
	print('NO')


n = int(input())
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	if a > b:
		tmp = a
		a = b
		b = tmp
	if a == 0 and b == 0:
		print('YES')
	elif a == 0 or b > 2 * a:
		print('NO')
	elif (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


import math

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	(a, b) = Read.list_int()
	if (a + b) % 3 == 0:
		if math.fabs(a - b) <= min(a, b):
			print('YES')
			return
	print('NO')
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


t = int(input())
ans = []
for _ in range(t):
	(a, b) = map(int, input().split())
	if a * 2 < b or b * 2 < a or (a + b) % 3 != 0:
		ans.append('NO')
	elif a and b:
		ans.append('YES')
	elif not a and (not b):
		ans.append('YES')
	else:
		ans.append('NO')
print('\n'.join(ans))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	(c, d) = (2 * a - b, 2 * b - a)
	if c >= 0 and c % 3 == 0 and (b >= c / 3):
		print('YES')
	elif d >= 0 and d % 3 == 0 and (a >= d / 3):
		print('YES')
	else:
		print('NO')


import math

def function(a, b):
	l = [a, b]
	a1 = min(l)
	b1 = max(l)
	if 2 * a1 >= b1 and (a1 + b1) % 3 == 0:
		return 'YES'
	return 'NO'
t = int(input())
for k in range(t):
	(a, b) = map(int, input().rstrip().split())
	print(function(a, b))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	same = a - (b - a)
	if same % 3 == 0 and same >= 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	(n, k) = map(int, input().split())
	x = abs(n - k)
	if (min(n, k) - x) % 3 == 0 and max(n, k) <= 2 * min(n, k):
		print('YES')
	else:
		print('NO')
	t -= 1


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if (a + b) % 3 == 0 and min(a, b) * 2 >= max(a, b):
		print('YES')
	else:
		print('NO')


def solve(a, b):
	if (a + b) % 3 != 0:
		return False
	x_add_y = (a + b) // 3
	x_sub_y = a - b
	if (x_add_y + x_sub_y) % 2 != 0:
		return False
	x = (x_add_y + x_sub_y) // 2
	y = (x_add_y - x_sub_y) // 2
	if x < 0:
		return False
	if y < 0:
		return False
	return True

def main():
	cas = int(input())
	while cas > 0:
		cas -= 1
		(a, b) = map(int, input().split())
		ans = solve(a, b)
		if ans:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	m = (2 * a - b) / 3
	n = (2 * b - a) / 3
	if m == int(m) and m >= 0 and (n == int(n)) and (n >= 0):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	b = (2 * x - y) / 3
	a = y - x + b
	if a >= 0 and b >= 0 and (a % 1 == 0) and (b % 1 == 0):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if (a + b) % 3 != 0 or a > 2 * b or b > 2 * a:
		print('NO')
	else:
		print('YES')


def run_testcase():
	[a, b] = [int(x) for x in input().split()]
	if (a + b) % 3 != 0:
		return 'NO'
	x_l = (2 * b - a) // 3
	x_u = b - 2 * x_l
	if x_l >= 0 and x_u >= 0:
		return 'YES'
	x_l = (2 * a - b) // 3
	x_u = a - 2 * x_l
	if x_l >= 0 and x_u >= 0:
		return 'YES'
	return 'NO'
testcase_count = int(input())
for i in range(testcase_count):
	print(str(run_testcase()))


import sys
import bisect as b
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for i in range(inin()):
	(c, s) = cin()
	if c > s:
		(c, s) = (s, c)
	if (s + c) % 3 == 0 and 2 * c >= s:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	s = input()
	ar = s.split(' ')
	n1 = min(int(ar[0]), int(ar[1]))
	n2 = max(int(ar[0]), int(ar[1]))
	if (n1 + n2) % 3 == 0 and n2 - 2 * n1 <= 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for rep in range(0, t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if (a + b) % 3 == 0 and a <= 2 * b and (b <= 2 * a):
		print('YES')
	else:
		print('NO')


T = int(input())
answer = ''
for t in range(T):
	text = list(map(int, input().split(' ')))
	text.sort()
	a = text[1]
	b = text[0]
	if a == b * 2:
		answer += 'YES\n'
		continue
	if b * 2 < a:
		answer += 'NO\n'
		continue
	if (2 * b - a) % 3 == 0:
		answer += 'YES\n'
	else:
		answer += 'NO\n'
print(answer)


T = int(input())
for t in range(T):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	diff = b - a
	a -= diff
	b -= 2 * diff
	if a >= 0 and a % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
out = []
for i in range(t):
	ab = [int(c) for c in input().split()]
	if (ab[0] + ab[1]) % 3 != 0:
		out.append('NO')
	elif abs(ab[0] - ab[1]) > min(ab):
		out.append('NO')
	else:
		out.append('YES')
for i in range(t):
	print(out[i])


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : map(int, input().split())

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if y > x:
		(x, y) = (y, x)
	z = x - y
	if (x + y) % 3 != 0:
		print('NO')
		continue
	if z > min(x, y):
		print('NO')
		continue
	x -= 2 * z
	y -= z
	if x % 3 == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(map(int, input().split()))
	a.sort()
	need = a[1] - a[0]
	while need > 1 and a[0] > 0 and (a[1] > 0):
		time = need // 2
		time = min(a[0], time)
		a[0] -= time
		a[1] -= time * 2
		a.sort()
		need = a[1] - a[0]
	if a[0] == a[1]:
		if a[0] % 3 == 0:
			print('YES')
		else:
			print('NO')
	elif abs(a[0] - a[1]) == 1:
		a[0] -= 1
		a[1] -= 2
		if a[0] == a[1]:
			if a[0] % 3 == 0:
				print('YES')
			else:
				print('NO')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ma = max(a, b)
	mn = min(a, b)
	if ma - mn <= mn and (mn + mn - ma) % 3 == 0:
		print('YES')
	else:
		print('NO')


import sys

def input():
	return sys.stdin.readline()

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

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

def solve():
	t = 1
	t = int(input())
	while t:
		t -= 1
		(a, b) = mapi()
		ss = max(a, b)
		mm = min(a, b)
		if (mm + ss) % 3 == 0 and 2 * mm - ss >= 0:
			print('YES')
		else:
			print('NO')
solve()


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if max(n, m) > 2 * min(n, m):
		print('NO')
	elif (2 * min(n, m) - max(n, m)) % 3 == 0:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(0, a):
	n = []
	(A, B) = list(map(int, input().split()))
	n.append(A)
	n.append(B)
	n.sort()
	x = n[0]
	y = n[1]
	if (x + y) % 3 == 0 and y <= 2 * x:
		print('YES')
	else:
		print('NO')


n = int(input())
i = 1
while i <= n:
	(a, b) = map(int, input().split())
	if a * 2 < b or b * 2 < a:
		print('NO')
	else:
		c = a + b
		if c % 3 == 0:
			print('YES')
		else:
			print('NO')
	i = i + 1


from math import ceil
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	(a, b) = (min(a, b), max(a, b))
	if ceil(a / 2) <= b <= a * 2:
		if abs(2 * a - b) % 3 == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from sys import stdin as s
for i in range(int(s.readline())):
	(a, b) = map(int, input().split())
	(n, m) = ((2 * a - b) / 3, (2 * b - a) / 3)
	if n >= 0 and n == int(n) and (m >= 0) and (m == int(m)):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = list(map(int, input().split()))
	a.sort()
	if (a[0] + a[1]) % 3 == 0 and a[0] * 2 >= a[1]:
		print('YES')
	else:
		print('NO')


import os
import sys

def main():
	T = read_int()
	for _ in range(T):
		print('YES' if solve(*read_ints()) else 'NO')

def solve(A, B):
	p = -A + 2 * B
	q = 2 * A - B
	return p >= 0 and q >= 0 and (p % 3 == 0) and (q % 3 == 0)
DEBUG = 'DEBUG' in os.environ

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

def read_int():
	return int(inp())

def read_ints():
	return [int(e) for e in inp().split()]

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	if a * 2 < b:
		print('NO')
		continue
	c = b - a
	a -= c
	b -= c * 2
	if not a and (not b):
		print('YES')
		continue
	if not a or not b:
		print('NO')
		continue
	a = a % 3
	b = b % 3
	if not a and (not b):
		print('YES')
		continue
	if not a or not b:
		print('NO')
		continue
	if a == b:
		print('NO')
	else:
		print('YES')


from sys import stdin
input = lambda : stdin.readline().rstrip('\r\n')
input_a = lambda fun: map(fun, stdin.readline().split())

def read():
	(a, b) = input_a(int)
	return (a, b)

def solve(a, b):
	(a, b) = sorted([a, b], reverse=True)
	return (a + b) % 3 == 0 and a <= b * 2
for t in range(int(input())):
	result = solve(*read())
	print('YES' if result else 'NO')


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 10 ** 9 + 7
EPS = 1e-06

def value():
	return tuple(map(int, input().split()))

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

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(a, b) = sorted(value())
	if 2 * a >= b and (a + b) % 3 == 0:
		ans = 'YES'
	else:
		ans = 'NO'
	print(ans)


n = int(input())
for i in range(n):
	(a, b) = [int(x) for x in input().split(' ')]
	if (a + b) % 3 != 0:
		print('NO')
	elif max(a, b) > 2 * min(a, b):
		print('NO')
	elif (2 * min(a, b) - max(a, b)) % 3 == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin
with stdin as fin:
	q = int(fin.readline().rstrip())
	for i in range(q):
		[a, b] = [int(i) for i in fin.readline().rstrip().split()]
		if a > b:
			c = a
			a = b
			b = c
		if (a + b) % 3 == 0 and 2 * a >= b:
			print('YES')
		else:
			print('NO')


t = int(input())
for case in range(t):
	(c, d) = [int(zax) for zax in input().split()]
	a = min(c, d)
	b = max(c, d)
	if 2 * a - b >= 0 and 2 * b - a >= 0 and ((2 * b - a) % 3 == 0) and ((2 * a - b) % 3 == 0):
		print('YES')
	else:
		print('NO')


from collections import deque
from math import ceil, sqrt

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

def si():
	return input()

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
t = ii()
while t:
	t -= 1
	(a, b) = mi()
	if max(a, b) - min(a, b) <= min(a, b):
		if (a + b) % 3 == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def f():
	(a, b) = [int(s) for s in input().split()]
	c = 2 * a - b
	d = 2 * b - a
	if c < 0 or d < 0 or c % 3 != 0 or (d % 3 != 0):
		print('NO')
	else:
		print('YES')
n = int(input())
for i in range(n):
	f()


for _ in range(int(input())):
	(a, b) = [int(__) for __ in input().split()]
	if a == 0 and b == 0:
		print('YES')
		continue
	if a * b == 0:
		print('NO')
		continue
	if (a + b) % 3 == 0 and 2 * min(a, b) >= max(a, b):
		print('YES')
	else:
		print('NO')


def main():
	import sys
	input = sys.stdin.readline
	N = int(input())
	for _ in range(N):
		(a, b) = map(int, input().split())
		ok = 1
		x1 = 2 * b - a
		x2 = 2 * a - b
		if x1 % 3 != 0 or x1 < 0:
			ok = 0
		if x2 % 3 != 0 or x2 < 0:
			ok = 0
		if ok:
			print('YES')
		else:
			print('NO')
main()


import math
x = eval(input())
for i in range(x):
	y = input().split(' ')
	a = min(int(y[0]), int(y[1]))
	b = max(int(y[0]), int(y[1]))
	if b <= 2 * a and (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if (x + y) % 3 == 0 and abs(x - y) <= max(x, y) // 2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	mx = max(a, b)
	mn = min(a, b)
	if (mx + mn) % 3 == 0 and mx <= 2 * mn:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		print('YES')
	elif a == 0 or b == 0:
		print('NO')
	elif a == 1 and b == 1:
		print('NO')
	elif a == 2 and b == 2:
		print('NO')
	elif (a + b) % 3 == 0 and 2 * min(a, b) >= max(a, b):
		print('YES')
	else:
		print('NO')


cases = int(input())
for case in range(cases):
	(a, b) = list(map(int, input().split()))
	if a > b:
		(a, b) = (b, a)
	if b > a * 2:
		print('NO')
	elif (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout

def memoize(f):
	memo = {}

	def helper(*x):
		if x not in memo:
			memo[x] = f(*x)
		return memo[x]
	return helper

@memoize
def brute(x, y):
	if x == 0 and y == 0:
		return True
	if x <= 0 or y <= 0:
		return False
	return brute(x - 1, y - 2) or brute(x - 2, y - 1)

def ans(x, y):
	if x == 0 and y == 0:
		return True
	if x == 0 or y == 0:
		return False
	diff = abs(x - y)
	s = x + y
	if s % 3 != 0:
		return False
	steps = s / 3
	if diff % 2 != steps % 2:
		return False
	if diff > steps:
		return False
	return True

def main():
	data = stdin.read().split('\n')
	N = int(data[0])
	for row in data[1:N + 1]:
		(x, y) = map(int, row.split(' '))
		if ans(x, y):
			stdout.write('YES\n')
		else:
			stdout.write('NO\n')
main()


for _ in ' ' * int(input()):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	if a > 2 * b:
		print('NO')
	else:
		print('YNEOS'[(a + b) % 3 != 0::2])


t = int(input())
while t > 0:
	t = t - 1
	w = input()
	w = w.split()
	x = int(w[0])
	y = int(w[1])
	if x > y:
		(x, y) = (y, x)
	if (x + y) % 3 == 0 and y <= 2 * x:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	temp = a + b
	if temp % 3 == 0:
		if b - a > a:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


def check(a, b):
	if (2 * a - b) / 3 < 0 or (2 * a - b) % 3 != 0:
		return False
	A = (2 * a - b) / 3
	if (b - A) / 2 < 0 or (b - A) % 2 != 0:
		return False
	return True
T = int(input())
for t in range(T):
	(a, b) = [int(i) for i in input().split()]
	if check(a, b):
		print('YES')
	else:
		print('NO')


x = int(input())
for i in range(x):
	(q, w) = map(int, input().split())
	if (q + w) % 3 == 0 and q * 2 >= w and (w * 2 >= q):
		print('YES')
	else:
		print('NO')


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if val % ll[mid] == 0:
			ans = ll[mid]
			return binary(l, mid - 1, ll, val, ans)
		else:
			return binary(l, mid - 1, ll, val, ans)

def odd(n, ans, s):
	if n % 2 != 0 or n in s:
		return ans
	else:
		s.add(n)
		return odd(n // 2, ans + 1, s)
t = int(input())
for i in range(t):
	(n, m) = map(int, input().split(' '))
	if (n + m) % 3 == 0 and max(n, m) <= min(n, m) * 2:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(0, T):
	(a, b) = map(int, input().split())
	t1 = 2 * a - b
	t2 = 2 * b - a
	if t2 % 3 == 0 and t1 % 3 == 0 and (t1 >= 0) and (t2 >= 0):
		print('YES')
	else:
		print('NO')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	(a, b) = inp()
	if a > b:
		(a, b) = (b, a)
	if a * 2 < b:
		ans = 'NO'
	elif a == 2 * b:
		ans = 'YES'
	elif (2 * a - b) % 3 == 0:
		ans = 'YES'
	else:
		ans = 'NO'
	out(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if (a + b) % 3 == 0 and abs(a - b) <= min(a, b):
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
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))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

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

def main():
	n = int(input())
	for i in range(n):
		(a, b) = map(int, input().split())
		if a > b:
			(b, a) = (a, b)
		if b == 2 and a == 1:
			print('YES')
		elif a >= b - a and (a - (b - a)) % 3 == 0:
			print('YES')
		else:
			print('NO')
	return
main()


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ans = 'NO'
	if (a + b) % 3 == 0 and min(a, b) >= max(a, b) // 2 or a == b == 0:
		ans = 'YES'
	print(ans)


for _ in range(int(input())):
	l = list(map(int, input().split()))
	l = sorted(l)
	if l[1] > l[0] * 2:
		print('NO')
	else:
		l[1] -= l[0] * 2 + 3
		if l[1] % 3 == 0:
			print('YES')
		else:
			print('NO')


from copy import deepcopy
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	x = a - b
	if a - 2 * x < 0:
		print('NO')
		continue
	if (b - x) % 3 != 0:
		print('NO')
	else:
		print('YES')


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	d = abs(a - b)
	val = min(a, b)
	if d > val:
		print('NO')
	elif (a + b) % 3:
		print('NO')
	else:
		print('YES')


t = int(input())
while t:
	(a, b) = [int(x) for x in input().split()]
	if 2 * b - a >= 0 and (2 * b - a) % 3 == 0 and (2 * a - b >= 0) and ((2 * a - b) % 3 == 0):
		print('YES')
	else:
		print('NO')
	t -= 1


n = int(input())
S = []
for _ in range(n):
	temp = list(map(int, input().split()))
	S.append(temp)
for i in range(n):
	a = S[i][0]
	b = S[i][1]
	if a == 0 and b == 0:
		print('YES')
	elif a == 0 or b == 0:
		print('NO')
	elif (a - 2 * b) % 3 == 0 and (b - 2 * a) % 3 == 0 and (2 * a - b >= 0) and (2 * b - a >= 0):
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

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

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

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 solve():
	(a, b) = sep()
	(a, b) = (min(a, b), max(a, b))
	diff = min(b - a, a)
	a -= diff
	b -= 2 * diff
	b -= a // 3 * 3
	a = a % 3
	if a == 1 and b == 2:
		print('YES')
		return
	if a == 0 and b == 0:
		print('YES')
		return
	print('NO')
testcase(int(inp()))


t = int(input())
for _ in range(t):
	(a, b) = (int(x) for x in input().split(' '))
	if a == 0 and b == 0:
		print('YES')
	elif a == 0 or b == 0:
		print('NO')
	elif max(a, b) / min(a, b) <= 2 and (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for you in range(t):
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	maxa = max(a, b)
	mina = min(a, b)
	if maxa <= 2 * mina and (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
while n:
	n -= 1
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if (a + b) % 3 == 0 and 2 * a >= b:
		print('YES')
	else:
		print('NO')


for itr in range(int(input())):
	(x, y) = map(int, input().split())
	if 2 * min(x, y) < max(x, y):
		print('NO')
		continue
	x = x % 3
	y = y % 3
	(x, y) = (min(x, y), max(x, y))
	if x == 0 and y == 0:
		print('YES')
	elif x == 1 and y == 2:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	ma = max(a, b)
	mi = min(a, b)
	if mi >= ma / 2 and (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


for case in range(int(input())):
	(x, y) = [int(x) for x in input().split()]
	b = (2 * x - y) // 3
	a = x - 2 * b
	if (2 * x - y) % 3 == 0 and b >= 0 and (a >= 0):
		print('YES')
		continue
	(x, y) = (y, x)
	b = (2 * x - y) // 3
	a = x - 2 * b
	if (2 * x - y) % 3 == 0 and b >= 0 and (a >= 0):
		print('YES')
		continue
	print('NO')


cases = int(input())
tests = []
results = []
for i in range(cases):
	tests.append([int(item) for item in input().split()])
for test in tests:
	if sum(test) % 3 != 0:
		results.append('NO')
	else:
		total = sum(test) // 3
		op1 = test[0] - total
		op2 = test[1] - total
		if op1 >= 0:
			if op2 >= 0:
				results.append('YES')
			else:
				results.append('NO')
		else:
			results.append('NO')
for result in results:
	print(result)


from collections import defaultdict, Counter
from math import sqrt, log10, log2, log, gcd, floor, factorial
from bisect import bisect_left, bisect_right
from itertools import combinations, combinations_with_replacement
import sys, io, os
input = sys.stdin.readline
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
mod = 10 ** 9 + 7
inf = float('inf')

def get_list():
	return [int(i) for i in input().split()]
yn = lambda a: print('YES' if a else 'NO')
ceil = lambda a, b: (a + b - 1) // b
t = int(input())
for i in range(t):
	(x, y) = get_list()
	suma = (x + y) // 3
	diff = abs(x - y)
	first = (suma + diff) // 2
	second = (suma - diff) // 2
	if (x + y) % 3 != 0 or (diff + suma) % 2 != 0 or first < 0 or (second < 0):
		yn(0)
	else:
		yn(1)


t = int(input())
for _ in range(t):
	(a, b) = [int(p) for p in input().split()]
	if (a + b) % 3 == 0 and min(a, b) * 2 >= max(a, b):
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		if a <= 2 * b and (a + b) % 3 == 0:
			print('YES')
		else:
			print('NO')
	elif b <= 2 * a and (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(x, y) = (min(a, b), max(a, b))
	if 2 * x - y >= 0 and (2 * x - y) % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = sorted([a, b])
	if a == 1 and b == 1:
		print('NO')
		continue
	d = b - a
	if d > a:
		print('NO')
		continue
	y = (2 * b - a) / 3
	if y % 1 != 0:
		print('NO')
		continue
	x = (a - y) / 2
	if x % 1 == 0 and y >= 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	kk = list(map(int, input().split()))
	a = max(kk)
	b = min(kk)
	l = 0
	r = max(a, b)
	while True:
		mid = (l + r) // 2
		if a - 2 * mid == 2 * (b - mid) or 2 * (a - 2 * mid) == b - mid:
			print('YES')
			break
		elif a - 2 * mid > 2 * (b - mid) or 2 * (a - 2 * mid) < b - mid:
			r = mid
		else:
			l = mid
		if l == r or l == r - 1:
			print('NO')
			break


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	s = a + b
	f = True
	if s % 3 != 0:
		f = False
	if a > 2 * b:
		f = False
	if f:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(['NO', 'YES'][(a + b) % 3 == 0 and a <= 2 * b and (b <= 2 * a)])


import sys, math

def input():
	return sys.stdin.readline()[:-1]

def main():
	Q = int(input())
	for _ in range(Q):
		(a, b) = map(int, input().split())
		if a == 0 and b == 0:
			print('YES')
		elif a == 0 and b != 0:
			print('NO')
		elif a != 0 and b == 0:
			print('NO')
		elif (a + b) % 3 == 0:
			if min(a, b) >= abs(a - b):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
main()


for i in range(int(input())):
	(a, b) = map(int, input().split())
	mi = min(a, b)
	ma = max(a, b)
	r = 2 * mi - ma
	if r % 3 == 0 and r >= 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	if a % 2 == 0:
		if a / 2 <= b <= 2 * a and (a + b) % 3 == 0:
			print('YES')
		else:
			print('NO')
	elif int(a / 2) + 2 <= b <= a * 2 and (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	m1 = min(a, b)
	m2 = max(a, b)
	if (a + b) % 3 == 0 and m2 <= 2 * m1:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	maxi = max(a, b)
	mini = min(a, b)
	if maxi <= mini * 2 and (mini + maxi) % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	mini = min(a, b)
	minic = mini
	maxi = max(a, b)
	dif = maxi - mini
	div = (mini - dif) // 3
	mini = mini - div * 3
	maxi = maxi - div * 3
	if minic < dif:
		print('NO')
	elif dif == 0:
		if a % 3 == 0:
			print('YES')
		else:
			print('NO')
	elif maxi // mini == 2:
		print('YES')
	else:
		print('NO')


a = int(input())
for i in range(a):
	(x, y) = map(int, input().split())
	(x, y) = (min(x, y), max(x, y))
	if 2 * x < y:
		print('NO')
	elif 2 * x == y:
		print('YES')
	elif 2 * x - y > 0 and (2 * x - y) % 3 == 0:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	max1 = max(a, b)
	min1 = min(a, b)
	if max1 > 2 * min1 or (max1 + min1) % 3 != 0:
		print('NO')
	else:
		print('YES')


t = int(input())
arr = []
for _ in range(t):
	arr.append(list(map(int, input().strip().split())))
for n in range(t):
	if max(arr[n]) <= 2 * min(arr[n]) and sum(arr[n]) % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for testcase in range(t):
	A = [int(x) for x in input().split()]
	(a, b) = (A[0], A[1])
	if (2 * b - a) % 3 == 0 and 2 * b >= a and (2 * a >= b):
		print('YES')
	else:
		print('NO')


def solve():
	(a, b) = map(int, input().split())
	(a, b) = sorted([a, b])
	f = False
	if b - a <= a:
		a = 2 * a - b
		if a % 3 == 0:
			f = True
	if f:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(t):
	solve()


n = int(input())
for i in range(n):
	c = list(map(int, input().split()))
	a = int()
	b = int()
	if c[0] >= c[1]:
		a = c[0]
		b = c[1]
	else:
		b = c[0]
		a = c[1]
	if a > 2 * b:
		print('NO')
	else:
		k = a - b
		a = a - 2 * k
		b = b - k
		if a % 3 == 0:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	(a, b) = [int(s) for s in input().split()]
	if a == 1 and b == 1:
		print('NO')
		continue
	if a == 2 * b or b == 2 * a:
		print('YES')
		continue
	if a > 2 * b or b > 2 * a:
		print('NO')
	elif a % 3 == 0 and b % 3 == 0 or (a % 3 == 1 and b % 3 == 2) or (a % 3 == 2 and b % 3 == 1):
		print('YES')
	else:
		print('NO')


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = int(input())
for tt in range(t):
	(a, b) = map(int, sys.stdin.readline().split(' '))
	x = 2 * b - a
	y = 2 * a - b
	if x >= 0 and y >= 0 and (x % 3 == 0) and (y % 3 == 0):
		print('YES')
	else:
		print('NO')
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if (n + k) % 3 == 0 and min(n, k) * 2 >= max(n, k):
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def lessThanX(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def BinarySearch(a, x):
	i = bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def main():
	for i in range(ip()):
		(a, b) = ei()
		if a > b:
			(a, b) = (b, a)
		print('YES' if (a + b) % 3 == 0 and 2 * a >= b else '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))
ip = lambda : int(sys.stdin.readline().rstrip('\r\n'))
ai = lambda : list(map(int, sys.stdin.readline().split()))
ei = lambda : map(int, sys.stdin.readline().split())
main()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	distance = abs(a - b)
	if distance == min(a, b):
		print('YES')
	elif distance > min(a, b):
		print('NO')
	else:
		same_num = min(a, b) - distance
		if same_num % 3 == 0:
			print('YES')
		else:
			print('NO')


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

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

def fmi():
	return map(float, stdin.readline().split())

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

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()
ans = ['YES', 'NO']
for _ in range(ii()):
	f = 1
	(a, b) = mi()
	if (a or b) and a * b == 0:
		f = 1
	elif a > 2 * b or b > a * 2:
		f = 1
	elif not (a + b) % 3:
		f = 0
	print(ans[f])


n = int(input())
for i in range(n):
	(a, b) = sorted([int(x) for x in input().split()])
	if a * 2 >= b and (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b) = [int(i) for i in input().split()]
	if (a + b) % 3 != 0:
		print('NO')
		continue
	sum = (a + b) / 3
	if (sum + (a - b)) % 2 != 0 or sum + (a - b) < 0:
		print('NO')
		continue
	if (sum - (a - b)) % 2 != 0 or sum - (a - b) < 0:
		print('NO')
		continue
	print('YES')


def main():
	n = int(input())
	for i in range(n):
		(a, b) = [int(v) for v in input().split()]
		c = 2 * a - b
		d = 2 * b - a
		if c % 3 == 0 and d % 3 == 0 and (c >= 0) and (d >= 0):
			print('YES')
		else:
			print('NO')

def m1(a, b):
	d1 = a // 2
	a1 = a - 2 * d1
	b1 = b - d1
	return (a1, b1, d1)

def m2(a, b):
	d2 = min(b // 2, a)
	a2 = a - d2
	b2 = b - 2 * d2
	return (a2, b2, d2)
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if (a + b) % 3 == 0 and b <= 2 * a:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().strip().split())
	f = 0
	x = min(a, b)
	y = max(a, b)
	while True:
		if a > 2 * b or b > 2 * a:
			f = 1
			break
		if a == 0 and b == 0:
			break
		if a <= 0 or b <= 0:
			f = 1
			break
		if x == y:
			if x % 3 == 0 and y % 3 == 0:
				break
			else:
				f = 1
				break
		if y // x == 2:
			break
		mul = (y - x) // 2
		y -= (mul + 1) * 2
		x -= mul + 1
	if f == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	a = sorted([int(x) for x in input().split()])
	(b, c) = a
	if b * 2 >= c and (b + c) % 3 == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if (a + b) % 3 == 0 and b >= a - b and (a >= b - a):
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if a == 1 and b == 1:
		print('NO')
	elif b > 2 * a:
		print('NO')
	elif (2 * a - b) % 3 == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	ar = list(map(int, input().split()))
	if ar[0] == 1 and ar[1] == 1:
		print('NO')
	elif ar[0] > 2 * ar[1] or ar[1] > 2 * ar[0]:
		print('NO')
	elif (ar[0] + ar[1]) % 3 != 0:
		print('NO')
	else:
		print('YES')


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		x1 = 2 * a - b
		x2 = 2 * b - a
		if x1 % 3 == 0 and x2 % 3 == 0 and (x1 >= 0) and (x2 >= 0):
			print('YES')
		else:
			print('NO')
	return
main()


x = int(input())
for f in range(x):
	(a, b) = [int(i) for i in input().split()]
	if a == b and a == 0:
		print('YES')
	elif (a + b) % 3 == 0:
		mi = min(a, b)
		ma = max(a, b)
		if mi * 2 >= ma and (mi != 0 and ma != 0):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys
input = sys.stdin.readline
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
for (a, b) in AB:
	L = [a, b]
	m = min(L)
	l = max(L)
	if (a + b) % 3 == 0 and l <= m * 2:
		print('YES')
	else:
		print('NO')


cases = int(input())
tests = []
results = []
for i in range(cases):
	tests.append([int(item) for item in input().split()])

def bs(a, b):
	(left, right) = (0, a)
	while left <= right:
		mid = (left + right) // 2
		v1 = a - mid
		v2 = b - 2 * mid
		if v1 == 2 * v2:
			return True
		elif v1 > 2 * v2:
			right = mid - 1
		else:
			left = mid + 1
	return False
for test in tests:
	if bs(test[0], test[1]):
		results.append('YES')
	else:
		results.append('NO')
for result in results:
	print(result)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	if b > 2 * a:
		print('NO')
		continue
	if b == 2 * a:
		print('YES')
		continue
	rem = b - a
	b = b - 2 * rem
	a = a - rem
	if a % 3 == 0:
		print('YES')
	else:
		print('NO')


import sys
import math
T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	t = a << 1
	if t >= b:
		if (a + b) % 3:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
res = []
for i in range(0, t):
	(a, b) = map(int, input().split())
	if (a + b) % 3 != 0 or a * 2 < b or b * 2 < a:
		res.append('NO')
	else:
		res.append('YES')
for r in res:
	print(r)


from sys import stdin

def input():
	return stdin.buffer.readline()
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	if a == 2 * b or b == 2 * a:
		print('YES')
	else:
		x = 2 * a - b
		if x % 3 == 0 and x // 3 < b and (2 * x // 3 < a) and (x // 3 > 0):
			print('YES')
		else:
			x = 2 * b - a
			if x % 3 == 0 and x // 3 < a and (2 * x // 3 < b) and (x // 3 > 0):
				print('YES')
			else:
				print('NO')


for _ in range(int(input())):
	(m, n) = map(int, input().split())
	ch = 0
	(m, n) = (max(m, n), min(m, n))
	if m > 2 * n:
		ch = 0
	else:
		if m % 3 == 0 and n % 3 == 0:
			ch = 1
		d = m - n
		c1 = m - 2 * d
		c2 = n - d
		if c1 % 3 == 0 and c2 % 3 == 0:
			ch = 1
		c1 = m - 1
		c2 = n - 2
		if c1 == 2 * c2 or c2 == 2 * c1:
			ch = 1
		c1 = m - 2
		c2 = n - 1
		if c1 == 2 * c2 or c2 == 2 * c1:
			ch = 1
	if ch == 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for tc in range(t):
	(a, b) = map(int, input().split())
	if [a, b] == [1, 2] or [b, a] == [1, 2] or [a, b] == [0, 0]:
		print('YES')
	else:
		if a > b:
			(a, b) = (b, a)
		diff = b - a
		if a - diff == b - diff * 2 and (a - diff) % 3 == 0 and (a - diff >= 0) and (b - 2 * diff >= 0):
			print('YES')
		else:
			print('NO')


q = int(input())
for i in range(q):
	(x, y) = map(int, input().split(' '))
	if x > y:
		tmp = x
		x = y
		y = tmp
	if x == 0 and y == 0:
		print('YES')
	elif y <= 2 * x and (2 * x - y) % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
EPS = 1e-12
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	k1 = (-a + 2.0 * b) / 3.0
	k2 = (-b + 2.0 * a) / 3.0
	if k1 < 0 or k2 < 0:
		print('NO')
		continue
	if abs(round(k1) - k1) < EPS:
		print('YES')
	elif abs(round(k2) - k2) < EPS:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	t = [a, b]
	t.sort()
	diff = t[1] - t[0]
	t[1] -= 2 * diff
	t[0] -= diff
	if t[0] % 3 == 0 and t[0] >= 0:
		print('YES')
	else:
		print('NO')


from sys import stdin

def rl():
	return [int(w) for w in stdin.readline().split()]
(t,) = rl()
for _ in range(t):
	(a, b) = rl()
	if a > b:
		(a, b) = (b, a)
	if 2 * a >= b and (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 6)

def iin():
	return int(stdin.readline())

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

def main():
	n = iin()
	for _ in range(n):
		(a, b) = lin()
		(x, y) = ((2 * a - b) // 3, (2 * b - a) // 3)
		if x >= 0 and y >= 0 and (a - (2 * x + y) == 0) and (b - (2 * y + x) == 0):
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	x = 2 * b - a
	y = 2 * a - b
	if x % 3 != 0 and y % 3 != 0:
		print('NO')
		continue
	if x < 0 or y < 0:
		print('NO')
		continue
	print('YES')


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	m = max(a, b)
	s = min(a, b)
	d = m - s
	m = m - d * 2
	s = s - d
	if m % 3 == 0 and s % 3 == 0 and (m >= 0) and (s >= 0):
		print('YES')
	else:
		print('NO')


INF = 10 ** 10

def main():
	print = out.append
	(a, b) = get_list()
	(a, b) = (min(a, b), max(a, b))
	if 2 * a - b >= 0 and (2 * a - b) % 3 == 0:
		print('YES')
	else:
		print('NO')
import sys
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
[main() for _ in range(int(input()))]
print(*out, sep='\n')


import sys

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

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

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

def check(a, b):
	if a > b:
		(a, b) = (b, a)
	if b > 2 * a:
		return False
	if (a + b) % 3 == 0:
		return True
	else:
		return False
T = int(input())
while T:
	mydict = dict()
	(a, b) = get_ints()
	if check(a, b):
		print('YES')
	else:
		print('NO')
	T -= 1


n = int(input())
for i in range(n):
	p = [int(i) for i in input().split()]
	c = p[0]
	s = p[1]
	if (p[0] + p[1]) % 3 != 0 or (c > 2 * s or s > 2 * c):
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if b > 2 * a:
		print('NO')
		continue
	a = a % 3
	b = b % 3
	if a > b:
		(a, b) = (b, a)
	if a == 1 and b == 2 or (a == b and a == 0):
		print('YES')
	else:
		print('NO')


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
for _ in range(RI()):
	ab = RMI()
	print('YES' if sum(ab) % 3 == 0 and min(ab) * 2 >= max(ab) else 'NO')


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	flag = True
	if max(x, y) > 2 * min(x, y):
		flag = False
	if (x + y) % 3 != 0:
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for qq in range(int(input())):
	(a, b) = map(int, input().split())
	if a + b > 3 * min(a, b):
		print('NO')
	elif (a + b) % 3 != 0:
		print('NO')
		continue
	elif a == b == 0:
		print('YES')
	elif a == 0 or b == 0:
		print('NO')
	else:
		print('YES')


for i in ' ' * int(input()):
	(a, b) = map(int, input().split())
	if (a + b) % 3 == 0:
		if 2 * a >= b and 2 * b >= a:
			print('YES')
			continue
	print('NO')


n = int(input())
for i in range(0, n):
	ln = [int(j) for j in input().split(' ')]
	n = ln[0]
	m = ln[1]
	if n % 2 == 1:
		n -= 1
		m -= 2
	if n == 0 and m == 0:
		print('YES')
		continue
	if n <= 0 or m <= 0:
		print('NO')
		continue
	if (m - n // 2) % 3 == 0 and m * 2 >= n and (m <= n * 2):
		print('YES')
	else:
		print('NO')


for _ in ' ' * int(input()):
	(a, b) = map(int, input().split())
	print('YNEOS'[(max(a, b) + min(a, b)) % 3 != 0 or max(a, b) > 2 * min(a, b)::2])


n = int(input())
for _ in range(n):
	k = 0
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		k = 1
	while a > 0 and b > 0:
		if a < b:
			(a, b) = (b, a)
		p = max(1, (a - b) // 2)
		a -= 2 * p
		b -= p
		if a == b and a % 3 != 0:
			break
		elif a == b:
			k += 1
			break
	print('YES' if k == 1 else 'NO')


n = int(input())
ans = []
for _ in range(n):
	(a, b) = map(int, input().split())
	(m, d) = (min(a, b), abs(a - b))
	if (a + b) % 3 == 0 and 2 * b - a >= 0 and (2 * a - b >= 0):
		ans.append('YES')
	else:
		ans.append('NO')
for x in ans:
	print(x)


import sys
n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	if (x + y) % 3 != 0:
		print('NO')
	elif min(x, y) * 2 < max(x, y):
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	(a, b) = sorted(list(map(int, input().split())))
	if b == a * 2:
		print('YES')
	elif (a + b) % 3 == 0 and b <= a * 2:
		print('YES')
	else:
		print('NO')


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	(a, b) = nm()
	if a < b:
		(a, b) = (b, a)
	s = a - b
	print('YES' if b >= s and (b - s) % 3 == 0 else 'NO')
	return
T = ni()
for _ in range(T):
	solve()


T = int(input())

def read(n):
	s = input().split(' ')
	a = []
	for i in range(n):
		a.append(int(s[i]))
	return a
for Id in range(T):
	(a, b) = read(2)
	if a < b:
		(a, b) = (b, a)
	if a > 2 * b or (b * 2 - a) % 3 != 0:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	(a, b) = sorted(map(int, input().split()))
	if 2 * a < b or (a + b) % 3:
		print('NO')
	else:
		print('YES')


for t in range(int(input())):
	(a, b) = sorted([*map(int, input().split())], reverse=True)
	dif = a - b
	print('YES' if (b - dif) % 3 == 0 and b - dif >= 0 else 'NO')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	if x > 2 * y:
		print('NO')
	else:
		diff = x - y
		x -= 2 * diff
		y -= diff
		if x % 3 == 0:
			print('YES')
		else:
			print('NO')


for _ in [0] * int(input()):
	l = list(map(int, input().split()))
	l.sort()
	(a, b) = l
	if 2 * b - a >= 0 and (2 * b - a) % 3 == 0 and (2 * a - b >= 0) and ((2 * a - b) % 3 == 0):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	bads = [(1, 0), (1, 1), (2, 2), (2, 3), (3, 2), (3, 0), (0, 3)]
	if a == 0 and b == 0:
		print('YES')
	elif a > 2 * b or b > 2 * a:
		print('NO')
	elif (a + b) % 3 != 0:
		print('NO')
	else:
		print('YES')


t = int(input())
e = [[int(i) for i in input().split()] for i in range(t)]
for List in e:
	a = List[0]
	b = List[1]
	x = (2 * b - a) / 3
	y = (2 * a - b) / 3
	if x >= 0 and y >= 0 and x.is_integer() and y.is_integer():
		print('YES')
	else:
		print('NO')


import sys

def main():
	input_list = []
	for line in sys.stdin:
		input_list.append(line.rstrip('\n'))
	for line in input_list[1:]:
		if solve(int(line.split(' ')[0]), int(line.split(' ')[1])) == True:
			print('YES')
		else:
			print('NO')

def solve(a, b):
	x = (2 * b - a) / 3
	y = (2 * a - b) / 3
	return int(x) == x and int(y) == y and (x >= 0) and (y >= 0)
main()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	t = b - a
	t1 = max(a, b)
	t2 = min(a, b)
	(a, b) = (t2, t1)
	if b - a > a:
		print('NO')
	elif (b - 2 * (b - a)) % 3 == 0 and 2 * a - b >= 0:
		print('YES')
	else:
		print('NO')


import sys
ip = lambda : sys.stdin.readline().rstrip()
for _ in range(int(ip())):
	(a, b) = map(int, ip().split())
	(a, b) = sorted([a, b])
	if b <= 2 * a and (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	a = 0
	b = 0
	if x > y:
		b = x
		a = y
	else:
		b = y
		a = x
	if a < b / 2:
		print('NO')
	elif b == 2 * a:
		print('YES')
	else:
		res = b - a
		b = b - 2 * res
		a = a - res
		if a % 3 == 0 and b % 3 == 0:
			print('YES')
		else:
			print('NO')


def main():

	def solve():
		(a, b) = map(int, input().split())
		tx = 2 * b - a
		ty = 2 * a - b
		if tx % 3 == 0 and ty % 3 == 0 and (tx >= 0) and (ty >= 0):
			print('YES')
		else:
			print('NO')
	q = int(input())
	for _ in range(q):
		solve()
main()


from sys import *
t = int(stdin.readline())
for _ in range(t):
	(n, k) = map(int, stdin.readline().split())
	a = min(n, k)
	b = max(n, k)
	if (a + b) % 3 == 0 and a * 2 >= b:
		print('YES')
	else:
		print('NO')


a = int(input())
for _ in range(a):
	m = list(map(int, input().split()))
	if m[0] == 1 and m[1] == 1:
		print('NO')
	elif (m[0] + m[1]) % 3 != 0:
		print('NO')
	elif m[0] > 2 * m[1] or m[1] > 2 * m[0]:
		print('NO')
	else:
		print('YES')


from sys import stdin

def solve(tc):
	(a, b) = map(int, stdin.readline().split())
	if a == 0 and b == 0:
		print('YES')
		return
	big = max(a, b)
	small = min(a, b)
	if small == 0 or big > 2 * small or (a + b) % 3 != 0:
		print('NO')
		return
	print('YES')
	pass
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
mod = 10 ** 9 + 7
eps = 10 ** (-7)

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

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

def inpl_str():
	return list(sys.stdin.readline().split())
N = inp()
for _ in range(N):
	(a, b) = inpl()
	(a, b) = (min(a, b), max(a, b))
	a = b = a - (b - a)
	if a % 3 == 0 and a >= 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for test in range(t):
	(a, b) = map(int, input().split())
	if a * b == 0 and max(a, b) > 0:
		print('NO')
	elif a == b:
		if a % 3 == 0:
			print('YES')
		else:
			print('NO')
	elif (2 * a - b) % 3 == 0 and 2 * a >= b and (2 * b >= a):
		print('YES')
	else:
		print('NO')


n = int(input())
while n:
	n -= 1
	(a, b) = map(int, input().split())
	if min(a, b) * 2 >= max(a, b):
		print(['YES', 'NO', 'NO'][(a + b) % 3])
	else:
		print('NO')


from sys import stdin, stdout
import math
t = int(stdin.readline().strip())
for _ in range(t):
	(a, b) = list(map(int, stdin.readline().split()))
	if a > b:
		(a, b) = (b, a)
	k = b - a
	if a - k >= 0:
		if (a - k) % 3 == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(k, g) = map(int, input().split())
	if k == g == 0:
		print('YES')
		continue
	if (k + g) / 3 - int((k + g) / 3) == 0 and min(k, g) != 0 and (2 * min(k, g) >= max(k, g)):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	m = max(a, b)
	n = min(a, b)
	if m - n > n:
		print('NO')
	elif (m + n) % 3 == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	xx = 2 * b - a
	if xx < 0 or xx % 3 != 0:
		print('NO')
		continue
	x = xx // 3
	y = b - 2 * x
	if y < 0:
		print('NO')
		continue
	print('YES')


import sys, io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	a = [int(i) for i in input().split()]
	a.sort()
	x = a[0]
	y = a[1]
	if x < y // 2:
		print('NO')
		continue
	elif (x + y) % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	if x % 3 == 1 and y % 3 == 2 or (x % 3 == 2 and y % 3 == 1) or (x % 3 == 0 and y % 3 == 0):
		if (x + y) // 3 > min(x, y):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
for kkk in range(t):
	(a, b) = map(int, input().split())
	if a > 2 * b or b > 2 * a:
		print('NO')
	elif a == 0 and b == 0:
		print('YES')
	elif a == 0 or b == 0:
		print('NO')
	elif (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


import sys

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

def input():
	return sys.stdin.readline().rstrip('\n')

def oint():
	return int(input())
t = oint()
for _ in range(t):
	(A, B) = rint()
	(A, B) = (min(A, B), max(A, B))
	if (A + B) % 3:
		print('NO')
		continue
	ab = (A + B) // 3
	a = A - ab
	b = B - ab
	if a + b == ab and a >= 0 and (b >= 0):
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	z = abs(y - x)
	if (x + y) % 3 == 0 and abs(x - y) <= min(x, y):
		print('YES')
	else:
		print('NO')


from math import *
from sys import *
from heapq import *
from collections import defaultdict
from itertools import permutations
import os, sys
from io import IOBase, BytesIO
M = 10 ** 9 + 7

def graph_as_tree_1_root():
	n = int(input())
	dict = defaultdict(list)
	for _ in range(n - 1):
		(x, y) = list(map(int, input().split()))
		dict[x].append(y)
		dict[y].append(x)
	tree = [[1]]
	temp = [1]
	vall = 0
	seen = set([i for i in range(2, n + 1)])
	lol = []
	while len(seen) > 0:
		lol = list(seen)
		tt = []
		for x in temp:
			aa = []
			for val in dict[x]:
				if val in seen:
					aa += [val]
					seen.remove(val)
			dict[x] = aa
			tt += aa
		tree.append(tt)
		temp = tt
		vall += 1
	for x in lol:
		dict[x] = []
	print(tree, dict)

def pow(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res

def powmod(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b //= 2
	return res

def inv(a, m):
	return powmod(a, m - 2, m)

def alldivisors(n):
	list = []
	arr = []
	for i in range(1, int(sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				arr += [i]
			else:
				arr += [i]
				list.append(n // i)
	arr += list[::-1]
	return arr

def primefactorisation(n):
	potentional_p = 3
	itog_list = defaultdict(int)
	if n % 2 == 0:
		itog_list[2] = 0
	while n % 2 == 0:
		n = n // 2
		itog_list[2] += 1
	while n - 1:
		if potentional_p > n ** 0.5:
			itog_list[n] += 1
			return itog_list
		while n % potentional_p == 0:
			n = n // potentional_p
			itog_list[potentional_p] += 1
		potentional_p += 2
	return itog_list

def meth(a, b):
	lst = [b // a] * a
	b %= a
	for i in range(b):
		lst[i] += 1
	return lst

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = list(map(int, input().split()))
		if (a + b) % 3 != 0:
			print('NO')
		elif abs(a - b) <= (a + b) // 3:
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.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 _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	mi = max(a, b)
	ma = min(a, b)
	if mi // 2 <= ma:
		if any([mi % 3 == 1 and ma % 3 == 2, ma % 3 == 1 and mi % 3 == 2, mi % 3 == 0 and ma % 3 == 0]):
			print('YES')
			continue
	print('NO')


from os import path
import sys
from math import ceil, floor, gcd, log, log2, factorial
from collections import defaultdict, Counter
from itertools import permutations
maxx = float('inf')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
	I = lambda : int(sys.stdin.buffer.readline())
	tup = lambda : map(int, sys.stdin.buffer.readline().split())
	lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
	S = lambda : sys.stdin.readline().replace('\n', '').strip()

	def grid(r, c):
		return [lint() for i in range(r)]
	stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
	star = lambda x: print(' '.join(map(str, x)))
else:
	I = lambda : int(sys.stdin.buffer.readline())
	tup = lambda : map(int, sys.stdin.buffer.readline().split())
	lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
	S = lambda : sys.stdin.readline().replace('\n', '').strip()

	def grid(r, c):
		return [lint() for i in range(r)]
	stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
	star = lambda x: print(' '.join(map(str, x)))
for _ in range(I()):
	(a, b) = tup()
	if a < b:
		(a, b) = (b, a)
	print('YES') if (a + b) % 3 == 0 and 2 * b >= a else print('NO')


t = int(input())
for tc in range(t):
	(a, b) = map(int, input().split())
	(x, y) = sorted([a, b])
	diff = y - x
	x -= diff
	y -= 2 * diff
	if x >= 0 and x % 3 == 0 and (y >= 0) and (y % 3 == 0):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if (a + b) % 3 or max(a, b) > min(a, b) * 2:
		print('NO')
	else:
		print('YES')


n = int(input())
b = []
for i in range(n):
	a = [x for x in input().split(' ')]
	q = int(a[0])
	w = int(a[1])
	if q >= 0.5 * w and q <= 2 * w and ((2 * q - w) % 3 == 0):
		b.append('YES')
	else:
		b.append('NO')
for i in range(n):
	print(b[i])


T = input()
t = int(T)
i = 0
while i < t:
	N = input()
	sk = N.split(' ')
	a = int(sk[0])
	b = int(sk[1])
	mx = max(a, b)
	mn = min(a, b)
	if mx > 2 * mn or (mx + mn) % 3 != 0:
		print('NO')
	else:
		print('YES')
	i = i + 1


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


import math
for _ in range(int(input())):
	ab = list(str(input()).split(' '))
	a = int(ab[0])
	b = int(ab[1])
	lower_limit = math.ceil(a / 2)
	upper_limit = a * 2
	if b >= lower_limit and b <= upper_limit:
		z = (2 * a - b) / 3
		if z == int(z):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(q, w) = map(int, input().split())
	e = 2 * q - w
	if e % 3 == 0:
		a = e // 3
		s = q - 2 * a
		if a >= 0 and s >= 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split())
	s1 = 2 * a - b
	s2 = 2 * b - a
	if s1 >= 0 and s1 % 3 == 0 and (s2 >= 0) and (s2 % 3 == 0):
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
while t > 0:
	(a, b) = [int(i) for i in input().split()]
	mini = min(a, b)
	if (a + b) % 3 != 0:
		ans = 'NO'
	elif (a + b) // 3 <= mini:
		ans = 'YES'
	else:
		ans = 'NO'
	print(ans)
	t -= 1


import sys
import os.path
if os.path.isfile('in.txt'):
	sys.stdin = open('in.txt', 'r', encoding='utf-8')
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	diff = a - b
	a -= diff * 2
	b -= diff
	if a >= 0 and b >= 0 and (a % 3 == 0):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(ai, bi) = map(int, input().split())
	if 2 * bi - ai >= 0 and 2 * ai - bi >= 0 and ((2 * bi - ai) % 3 == 0) and ((2 * ai - bi) % 3 == 0):
		print('YES')
	else:
		print('NO')


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


n = int(input())
for cn in range(1, n + 1):
	(a, b) = map(int, input().split())
	if a > 2 * b or a * 2 < b:
		print('NO')
	elif (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
B = [0]
for i in range(t):
	(a, b) = map(int, input().split())
	c = a + b
	d = abs(a - b)
	if c % 3 == 0 and (d <= a and d <= b):
		if a > 0 and b > 0 or c == 0:
			B.append('YES')
		else:
			B.append('NO')
	else:
		B.append('NO')
for i in range(t):
	print(B[i + 1])


T = int(input())
for t in range(T):
	(a, b) = list(map(int, input().split()))
	(mini, maxi) = (min(a, b), max(a, b))
	diff = maxi - mini
	if diff > mini:
		res = 'NO'
	else:
		mini -= diff
		maxi -= 2 * diff
		r1 = mini % 3
		r2 = maxi % 3
		if r1 == 0 and r2 == 0:
			res = 'YES'
		elif r1 == 1 and r2 == 2:
			res = 'YES'
		elif r1 == 2 and r2 == 1:
			res = 'YES'
		else:
			res = 'NO'
	print(res)


t = int(input())
for T in range(t):
	(a, b) = [int(x) for x in input().split()]
	if (a + b) % 3 == 0 and a <= b * 2 <= a * 4:
		print('YES')
	else:
		print('NO')


t = int(input())
for case_num in range(t):
	(a, b) = map(int, input().split(' '))
	if a > b:
		tmp = a
		a = b
		b = tmp
	print('YES' if (a + b) % 3 == 0 and a * 2 >= b else 'NO')


t = int(input())
for i in range(0, t):
	(x, y) = map(int, input().split())
	if x == 0 and y == 0:
		print('YES')
	elif x == 0 and y != 0 or (y == 0 and x != 0):
		print('NO')
	elif max(x / y, y / x) > 2:
		print('NO')
	elif (x + y) % 3 == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	mi = min(a, b)
	mx = max(a, b)
	if (a + b) % 3 == 0 and 2 * mi >= mx:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	(a, b) = [int(x) for x in input().split(' ')]
	if a == 1 and b == 1 or (a == 2 and b == 2) or a > 2 * b or (b > 2 * a) or ((a + b) % 3 != 0):
		print('NO')
	else:
		print('YES')


def bs(a, b):
	(l, r) = (0, a)
	while l <= r:
		m = (l + r) // 2
		if a - m == 2 * (b - 2 * m):
			return True
		elif a - m < 2 * (b - 2 * m):
			l = m + 1
		else:
			r = m - 1
	return False
n = int(input())
results = []
for i in range(n):
	vals = input().split()
	a = int(vals[0])
	b = int(vals[1])
	if a > b:
		(a, b) = (b, a)
	if bs(a, b):
		results.append('YES')
	else:
		results.append('NO')
for result in results:
	print(result)


l = []
for i in range(int(input())):
	a = input().split()
	if (int(a[0]) + int(a[1])) % 3 == 0 and abs(int(a[0]) - int(a[1])) <= min(int(a[0]), int(a[1])):
		print('YES')
	else:
		print('NO')


import math
t = int(input())
while t > 0:
	(n, m) = map(int, input().split())
	if n == 0 and m == 0:
		print('YES')
	else:
		k = m + n
		if k % 3 == 0 and max(m, n) <= 2 * min(m, n):
			print('YES')
		else:
			print('NO')
	t -= 1


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		(a, b) = ain()
		if a > b:
			(a, b) = (b, a)
		if (a + b) % 3 == 0 and a * 2 >= b:
			print('YES')
		else:
			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')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	(x, y) = map(int, input().split())
	if not (x + y) % 3 and min(x, y) >= (x + y) // 3:
		print('YES')
	else:
		print('NO')


import sys
import math
import itertools
import collections

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)

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)
t = ii()
for _ in range(t):
	(a, b) = sorted(mi())
	if (a + b) % 3 != 0 or b > 2 * a:
		print('NO')
	else:
		print('YES')


testCases = int(input())
answerArray = []
for i in range(testCases):
	input1 = list(map(int, input().split(' ')))
	a = input1[0]
	b = input1[1]
	if a > b * 2 or (a + b) % 3 != 0 or b > a * 2:
		answerArray.append('NO')
	else:
		answerArray.append('YES')
for i in answerArray:
	print(i)


x = int(input())
for i in range(x):
	(n, m) = [int(a) for a in input().split()]
	if 2 * min(n, m) < max(m, n) or (n + m) % 3:
		print('NO')
	else:
		print('YES')


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	zz = 0
	for _ in range(ri()):
		(a, b) = ria()
		(a, b) = (min(a, b), max(a, b))
		x = b - a
		y = a - x
		z = b - 2 * x
		if y == 0 and z == 0 or (y % 3 == 0 and z % 3 == 0 and (max(y, z) >= 3)):
			print('YES')
		else:
			print('NO')
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			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, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			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()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

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

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


t = int(input())
import math
for j in range(t):
	(a, b) = list(map(int, input().split()))
	if a == 0 and b == 0:
		print('YES')
	elif a == 0 or b == 0:
		print('NO')
	elif (a + b) % 3 == 0 and abs(a - b) <= min(a, b):
		print('YES')
	else:
		print('NO')


T = int(input())
while T > 0:
	(a, b) = [int(x) for x in input().split()]
	if a > b:
		temp = a
		a = b
		b = temp
	if a == b and a % 3 == 0:
		print('YES')
		T -= 1
		continue
	k = b - a - 1
	if k > 0:
		a -= k
		b -= 2 * k
	if a > 0 and b > 1:
		a = a - 1
		b = b - 2
		print('YES' if a % 3 == 0 and b % 3 == 0 else 'NO')
	else:
		print('NO')
	T -= 1


def solve(a, b):
	ans = 'YES'
	if a > b:
		(a, b) = (b, a)
	if (a + b) % 3 != 0:
		ans = 'NO'
	elif 2 * a < b:
		ans = 'NO'
	print(ans)

def main():
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		solve(a, b)
main()


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	ma = max(a, b)
	mi = min(a, b)
	if ma > 2 * mi:
		print('NO')
	elif ma == 2 * mi:
		print('YES')
	else:
		d = ma - mi
		mi = mi - d
		if mi % 3 == 0:
			print('YES')
		else:
			print('NO')
	t = t - 1


tests = int(input())
for t in range(tests):
	(x, y) = list(map(int, input().split(' ')))
	a = (2 * y - x) // 3
	b = (2 * x - y) // 3
	if a + 2 * b == x and 2 * a + b == y and (b >= 0) and (a >= 0):
		print('YES')
	else:
		print('NO')


n = int(input())
for v in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	c = min(a, b)
	d = max(a, b)
	if 2 * c >= d and (a + b) % 3 == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
a = []
for i in range(n):
	a.append([int(x) for x in input().split(' ')])
for i in a:
	x1 = i[0]
	x2 = i[1]
	if min(x1, x2) >= abs(x1 - x2):
		nums = min(x1, x2) - abs(x1 - x2)
		if nums == 0:
			print('YES')
		elif nums % 3 == 0:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for k in range(int(input())):
	t = list(map(int, input().split()))
	if sum(t) % 3 == 0 and min(t) * 2 >= max(t):
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
from io import BytesIO, IOBase
import os, sys, math, heapq, copy
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right
from functools import cmp_to_key
from itertools import permutations, combinations, combinations_with_replacement
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
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')
mod = 1000000007

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

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

def get_float():
	return float(sys.stdin.readline().strip())

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

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

def get_floats():
	return map(float, sys.stdin.readline().strip().split())

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

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

def list_floats():
	return list(map(float, sys.stdin.readline().strip().split()))
t = get_int()
for _ in range(t):
	(a, b) = get_ints()
	if (a + b) % 3 == 0 and (2 * a >= b and 2 * b >= a):
		print('YES')
	else:
		print('NO')


from collections import Counter, deque, defaultdict, OrderedDict, namedtuple
from bisect import bisect_left, bisect_right, insort
from math import sqrt, ceil, floor, factorial, gcd
mod = 10 ** 9 + 7
from sys import stdin
t = int(stdin.readline())
while t:
	(a, b) = map(int, stdin.readline().split())
	k = 'NO'
	if a == 1 and b == 1:
		k = 'NO'
	(b, a) = (max(a, b), min(a, b))
	if b > 2 * a:
		k = 'NO'
	elif (b - 2 + a - 1) % 3 == 0:
		k = 'YES'
	print(k)
	t -= 1


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def xrange(n):
	return range(1, n + 1)
MOD = 10 ** 9 + 7
INF = 10 ** 20
I = lambda : list(map(int, input().split()))
from collections import defaultdict as dd
from math import gcd
import string
import heapq
for _ in range(int(input())):
	(a, b) = I()
	y = (2 * a - b) // 3
	x = a - 2 * y
	ans = 'NO'
	if x >= 0 and y >= 0 and (a - x - 2 * y == 0) and (b - y - 2 * x == 0):
		ans = 'YES'
	print(ans)


n = int(input())
for i in range(n):
	ch = input()
	L = [int(i) for i in ch.split()]
	a = L[0]
	b = L[1]
	if a == b:
		if a % 3 == 0:
			print('YES')
		else:
			print('NO')
	if a > b:
		x = a - b
		a = a - 2 * x
		b = b - x
		if a % 3 == 0 and b >= 0 and (a == b):
			print('YES')
		else:
			print('NO')
	elif b > a:
		x = b - a
		b = b - 2 * x
		a = a - x
		if b % 3 == 0 and a >= 0 and (a == b):
			print('YES')
		else:
			print('NO')


import math
from math import gcd as gc
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	if b == 2 * a:
		print('YES')
	elif b > 2 * a or (a - b % a) % 3 != 0:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(a, b) = sorted(list(map(int, input().split())))
	if b > 2 * a:
		print('NO')
	else:
		print('YES' if (a + b) % 3 == 0 else 'NO')


for w in range(int(input())):
	(a, b) = tuple(map(int, input().split()))
	if a == 0 and b == 0:
		print('YES')
	elif a == 0 or b == 0:
		print('NO')
	elif a == b:
		if a % 3 == 0:
			print('YES')
		else:
			print('NO')
	elif b > a:
		if (a + b) % 3 == 0 and b <= 2 * a:
			print('YES')
		else:
			print('NO')
	elif (a + b) % 3 == 0 and a <= 2 * b:
		print('YES')
	else:
		print('NO')


from collections import deque
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = int(a - 2 * ((2 * a - b) / 3))
	y = int((2 * a - b) / 3)
	if 2 * y + x == a and y + 2 * x == b and (x >= 0) and (y >= 0):
		print('YES')
	else:
		print('NO')


def solve(a, b):
	if b > 2 * a:
		return 'NO'
	if (a + b) % 3 == 0:
		return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	print(solve(a, b))


n = int(input())
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	ta = max(a, b)
	tb = min(a, b)
	if ta // 2 <= tb:
		if ta % 3 == 1 and tb % 3 == 2:
			print('YES')
			continue
		if tb % 3 == 1 and ta % 3 == 2:
			print('YES')
			continue
		if ta % 3 == 0 and tb % 3 == 0:
			print('YES')
			continue
	print('NO')


from math import ceil
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if 2 * a == b:
		print('YES')
	else:
		lg = b - a + 1
		aa = a - (lg - 1)
		bb = b - (lg - 1) * 2
		if aa < 0 or bb < 0:
			print('NO')
		elif aa % 3 == 0:
			print('YES')
		else:
			print('NO')


def fun(A, B):
	Max = max(A, B)
	Min = min(A, B)
	if Min * 2 >= Max and (Max + Min) % 3 == 0:
		return True
	else:
		return False
for _ in range(int(input())):
	(A, B) = map(int, input().split())
	if fun(A, B):
		print('YES')
	else:
		print('NO')


import sys
sys.setrecursionlimit(10 ** 7)
from collections import deque
import math
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if (a + b) % 3 == 0 and 2 * min(a, b) >= max(a, b):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(X, Y) = map(int, input().split())
	if X > Y:
		(X, Y) = (Y, X)
	if X == 1 and Y == 1:
		print('NO')
	elif Y > 2 * X:
		print('NO')
	elif (2 * X - Y) % 3 == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(N, M) = map(int, input().split())
	if (N + M) % 3 == 0 and 2 * N >= M and (2 * M >= N):
		print('YES')
	else:
		print('NO')


t = int(input())
for nt in range(t):
	(a, b) = [int(k) for k in input().strip().split(' ')]
	if (a + b) % 3 or 2 * a < b or 2 * b < a:
		print('NO')
	else:
		print('YES')


import sys

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	(a, b) = MAP()
	(a, b) = (min(a, b), max(a, b))
	if a * 2 >= b and (a + b) % 3 == 0:
		YES()
	else:
		NO()


q = int(input())
for i in range(q):
	(w, e) = map(int, input().split())
	(w, e) = sorted((w, e))
	r = e - w
	e -= r * 2
	w -= r
	if e > w:
		e -= 2
		w -= 1
	if w > e:
		w -= 2
		e -= 1
	if e < 0 or w < 0:
		print('NO')
	elif w % 3 == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	if (a + b) % 3 == 0 and a <= 2 * b:
		print('YES')
	else:
		print('NO')