There are n games in a football tournament. Three teams are participating in it. Currently k games had already been played. 

You are an avid football fan, but recently you missed the whole k games. Fortunately, you remember a guess of your friend for these k games. Your friend did not tell exact number of wins of each team, instead he thought that absolute difference between number of wins of first and second team will be d_1 and that of between second and third team will be d_2.

You don't want any of team win the tournament, that is each team should have the same number of wins after n games. That's why you want to know: does there exist a valid tournament satisfying the friend's guess such that no team will win this tournament?

Note that outcome of a match can not be a draw, it has to be either win or loss.


-----Input-----

The first line of the input contains a single integer corresponding to number of test cases t (1 ≤ t ≤ 10^5).

Each of the next t lines will contain four space-separated integers n, k, d_1, d_2 (1 ≤ n ≤ 10^12; 0 ≤ k ≤ n; 0 ≤ d_1, d_2 ≤ k) — data for the current test case.


-----Output-----

For each test case, output a single line containing either "yes" if it is possible to have no winner of tournament, or "no" otherwise (without quotes).


-----Examples-----
Input
5
3 0 0 0
3 3 0 0
6 4 1 0
6 3 3 0
3 3 3 2

Output
yes
yes
yes
no
no



-----Note-----

Sample 1. There has not been any match up to now (k = 0, d_1 = 0, d_2 = 0). If there will be three matches (1-2, 2-3, 3-1) and each team wins once, then at the end each team will have 1 win.

Sample 2. You missed all the games (k = 3). As d_1 = 0 and d_2 = 0, and there is a way to play three games with no winner of tournament (described in the previous sample), the answer is "yes".

Sample 3. You missed 4 matches, and d_1 = 1, d_2 = 0. These four matches can be: 1-2 (win 2), 1-3 (win 3), 1-2 (win 1), 1-3 (win 1). Currently the first team has 2 wins, the second team has 1 win, the third team has 1 win. Two remaining matches can be: 1-2 (win 2), 1-3 (win 3). In the end all the teams have equal number of wins (2 wins).

Starter code:

Solutions:
def main():
    t = int(input())
    for z in range(t):
        n, k, d1, d2 = map(int, input().split())
        if n % 3 != 0:
            print('no')
            continue
        f = 0
        for i in [-1, +1]:
            for j in [-1, +1]:
                w = (k - i * d1 - j * d2)
                if f == 0 and (w % 3 == 0) and (n//3)>=(w//3)>=0 and (n//3)>=(w//3 + i * d1)>=0 and (n//3)>=(w//3 + j * d2)>=0:
                    print('yes')
                    f = 1
        if f == 0:
            print('no')
main()

import itertools
import sys


'''
w1 - w2 = d1
w2 - w3 = d2
w1 + w2 + w3 = k

w1 = w2 + d1
w3 = w2 - d2
w2 + d1 + w2 + w2 - d2 = k

w2 = (k - d1 + d2) / 3
w1 = w2 + d1
w3 = w2 - d2
'''
for _ in range(int(input())):

    n, k, d1, d2 = list(map(int, str.split(sys.stdin.readline())))
    for s1, s2 in itertools.product((1, -1), repeat=2):

        cd1, cd2 = d1 * s1, d2 * s2
        w2 = k - cd1 + cd2
        if w2 % 3 != 0:

            continue

        w2 //= 3
        w1 = w2 + cd1
        w3 = w2 - cd2
        if w1 >= 0 and w2 >= 0 and w3 >= 0:

            d = n - k
            mw = max((w1, w2, w3))
            nw = 3 * mw - w1 - w2 - w3
            if d >= nw and (d - nw) % 3 == 0:

                print("yes")
                break

    else:

        print("no")


def f1(d1, d2, n, k):
    a1 = 2 * d1 + d2 + k
    a2 = -d1 + d2 + k
    a3 = -d1 - (2 * d2) + k
    if (a1 < 0 or a2 < 0 or a3 < 0 or a1 % 3 or a2 % 3 or a2 % 3):
        return False
    else:
        a1 //= 3
        a2 //= 3 
        a3 //= 3
        a1, a2, a3 = tuple(sorted([a1, a2, a3])[::-1])
        if (a2 - a3 + 2 * (a1 - a2)) > n - k:
            return False
        else:
            return True

def f2(d1, d2, n, k):
    a1 = -2 * d1 + d2 + k
    a2 = d1 + d2 + k
    a3 = d1 - (2 * d2) + k
    if (a1 < 0 or a2 < 0 or a3 < 0 or a1 % 3 or a2 % 3 or a2 % 3):
        return False
    else:
        a1 //= 3
        a2 //= 3 
        a3 //= 3
        a1, a2, a3 = tuple(sorted([a1, a2, a3])[::-1])
        if (a2 - a3 + 2 * (a1 - a2)) > n - k:
            return False
        else:
            return True

def f3(d1, d2, n, k):
    a1 = 2 * d1 - d2 + k
    a2 = -d1 - d2 + k
    a3 = -d1 + (2 * d2) + k
    if (a1 < 0 or a2 < 0 or a3 < 0 or a1 % 3 or a2 % 3 or a2 % 3):
        return False
    else:
        a1 //= 3
        a2 //= 3 
        a3 //= 3
        a1, a2, a3 = tuple(sorted([a1, a2, a3])[::-1])
        if (a2 - a3 + 2 * (a1 - a2)) > n - k:
            return False
        else:
            return True

def f4(d1, d2, n, k):
    a1 = -2 * d1 - d2 + k
    a2 = d1 - d2 + k
    a3 = d1 + (2 * d2) + k
    if (a1 < 0 or a2 < 0 or a3 < 0 or a1 % 3 or a2 % 3 or a2 % 3):
        return False
    else:
        a1 //= 3
        a2 //= 3 
        a3 //= 3
        a1, a2, a3 = tuple(sorted([a1, a2, a3])[::-1])
        if (a2 - a3 + 2 * (a1 - a2)) > n - k:
            return False
        else:
            return True


a = []
z = int(input())

for i in range(z):
    n, k, d1, d2 = map(int, input().split())
    v1 = f1(d1, d2, n, k)
    v2 = f2(d1, d2, n, k)
    v3 = f3(d1, d2, n, k)
    v4 = f4(d1, d2, n, k)
    
        
    if (v1 or v2 or v3 or v4) and n % 3 == 0:
        a.append('yes')
    else:
        a.append('no')
    
    
print(*a, sep = '\n')

q = int(input())

while q > 0:
    n, k, d1, d2 = list(map(int, input().split()))
    if d1 > d2:
        d1, d2 = d2, d1
    if k - 2 * d1 - d2 >= 0 and (k - 2 * d1 - d2) % 3 == 0 and \
            (n - k) - d1 - 2 * d2 >= 0 and ((n - k) - d1 - 2 * d2) % 3 == 0:
        print('yes')
    elif k - 2 * d2 - d1 >= 0 and (k - 2 * d2 - d1) % 3 == 0 and \
            (n - k) - d2 - 2 * d1 >= 0 and ((n - k) - d2 - 2 * d1) % 3 == 0:
        print('yes')
    elif k - 2 * d2 + d1 >= 0 and (k - 2 * d2 + d1) % 3 == 0 and \
            (n - k) - d2 - d1 >= 0 and ((n - k) - d2 - d1) % 3 == 0:
        print('yes')
    elif k - d1 - d2 >= 0 and (k - d1 - d2) % 3 == 0 and \
            (n - k) - 2 * d2 + d1 >= 0 and ((n - k) - 2 * d2 + d1) % 3 == 0:
        print('yes')
    else:
        print('no')
    q -= 1


t = int(input())
for l in range(t):
    n, k, d1, d2 = map(int, input().split())
    if n % 3 != 0:
        print("no")
        continue
    n = n // 3
    ok = False
    for i in [-1, 1]:
        for j in [-1, 1]:
            tmp = k;
            tmp -= d1 * i
            tmp -= d1 * i
            tmp -= d2 * j
            if tmp % 3 != 0: continue
            if tmp < 0: continue
            tmp = tmp // 3
            x1 = tmp
            x2 = x1 + d1 * i
            x3 = x2 + d2 * j
            if x1 < 0 or x2 < 0 or x3 < 0: continue
            if x1 <= n and x2 <= n and x3 <= n:
                ok = True
                break
    if ok: print("yes")
    else: print("no")

t = int(input())
for _ in range(t):
    n, k, d1, d2 = map(int, input().split())
    if n % 3 != 0:
        print("no")
        continue
    n = n // 3
    ok = False
    for i in [-1, 1]:
        for j in [-1, 1]:
            tmp = k;
            tmp -= d1 * i
            tmp -= d1 * i
            tmp -= d2 * j
            if tmp % 3 != 0: continue
            if tmp < 0: continue
            tmp = tmp // 3
            x1 = tmp
            x2 = x1 + d1 * i
            x3 = x2 + d2 * j
            if x1 < 0 or x2 < 0 or x3 < 0: continue
            if x1 <= n and x2 <= n and x3 <= n:
                ok = True
                break
    if ok: print("yes")
    else: print("no")

def doall():
    t = int(input())
    def solve(n, k, d1, d2):
        if n % 3 == 0:
            r = n - k
            a = [[0, d1, d1 + d2],
                 [0, d1, d1 - d2],
                 [0, -d1, -d1 + d2],
                 [0, -d1, -d1 - d2]]
            for now in a:
                mn = min(now)
                sumn = sum(now)
                sumb = sumn - 3 * min(now)
                if k < sumb or (k - sumb) % 3 != 0:
                    continue
                w = max(now)
                tmp = 3 * w - sumn
                if tmp <= r and (r - tmp) % 3 == 0:
                    
                    return True
        return False
    ans = []
    for i in range(t):
        n, k, d1, d2 = list(map(int, input().split()))
        if solve(n, k, d1, d2):
            ans.append('yes')
        else:
            ans.append('no')
    print('\n'.join(ans))
                
doall()

def f(x, y, a, b): return x > a or y > b or (a - x) % 3 or (b - y) % 3
def g(x, y, a, b): return f(x, y, a, b) and f(x, y, b, a)
for i in range(int(input())):
    n, u, a, b = map(int, input().split())
    v, s, t = n - u, a + b, 2 * b - a if b > a else 2 * a - b
    print('no' if g(s, t, u, v) and g(s + a, s + b, u, v) else 'yes')

for i in range(int(input())):
    n, u, a, b = map(int, input().split())
    if n % 3: print('no')
    else:
        if a > b: a, b = b, a
        p, q = a + b, 2 * b - a
        s, r, v = p + a, p + b, n - u
        t = [(p, q), (q, p), (s, r), (r, s)]
        print('no' if all(x > u or (x - u) % 3 or y > v or (y - v) % 3 for x, y in t) else 'yes')

read = lambda: list(map(int, input().split()))
f = lambda x, y, a, b: x > a or y > b or (a - x) % 3 or (b - y) % 3
g = lambda x, y, a, b: f(x, y, a, b) and f(x, y, b, a)
t = int(input())
for i in range(t):
    n, k, d1, d2 = read()
    r = n - k
    d = d1 + d2
    p = 2 * d2 - d1 if d2 > d1 else 2 * d1 - d2
    print('no' if g(d, p, k, r) and g(d + d1, d + d2, k, r) else 'yes')


t=int(input())

for j in range(t):
  inp=[int(n) for n in input().split()]
  n=inp[0]
  k=inp[1]
  d1=inp[2]
  d2=inp[3]
  
  if d2<d1:
    s=d1
    d1=d2
    d2=s
  
  if ((k>=2*d1+d2) and ((k-2*d1-d2)%3==0) and (n-k>=d1+2*d2) and ((n-k-d1-2*d2)%3==0)):
    print('yes')
  elif ((k>=2*d2+d1) and ((k-2*d2-d1)%3==0) and (n-k>=d2+2*d1) and ((n-k-d2-2*d1)%3==0)):
    print('yes')
  elif ((k>=d1+d2) and ((k-d1-d2)%3==0) and (n-k>=2*d2-d1) and ((n-k-2*d2+d1)%3==0)):
    print('yes')
  elif ((k>=2*d2-d1) and ((k-2*d2+d1)%3==0) and (n-k>=d1+d2) and ((n-k-d1-d2)%3==0)):
    print('yes')
  else:
    print('no')

from sys import *

t=int(stdin.readline())
for i in range(t):
    n,k,d1,d2=(int(z) for z in stdin.readline().split())
    vars=[[2*d1+d2,2*d2+d1],[2*d2+d1,2*d1+d2],[2*max(d1,d2)-min(d1,d2),d1+d2], [d1+d2,2*max(d1,d2)-min(d1,d2)]]
    y=False
    for i in vars:
        if i[0]<=k and i[0]%3==k%3 and n-k-i[1]>=0 and (n-i[1]-k)%3==0:
            print("yes")
            y=True
            break
    if not y:
        print("no")

from sys import *

t=int(stdin.readline())
for i in range(t):
    n,k,d1,d2=(int(z) for z in stdin.readline().split())
    vars=((2*d1+d2,2*d2+d1),(2*d2+d1,2*d1+d2),(2*max(d1,d2)-min(d1,d2),d1+d2), (d1+d2,2*max(d1,d2)-min(d1,d2)))
    y=False
    for i in vars:
        if i[0]<=k and i[0]%3==k%3 and n-k-i[1]>=0 and (n-i[1]-k)%3==0:
            print("yes")
            y=True
            break
    if not y:
        print("no")

from sys import *

t=int(stdin.readline())
for i in range(t):
    n,k,d1,d2=(int(z) for z in stdin.readline().split())
    vars=((2*d1+d2,2*d2+d1),(2*max(d1,d2)-min(d1,d2),d1+d2))
    y=False
    for i in vars:
        if i[0]<=k and i[0]%3==k%3 and n-k-i[1]>=0 and (n-i[1]-k)%3==0:
            print("yes")
            y=True
            break
        if i[1]<=k and i[1]%3==k%3 and n-k-i[0]>=0 and (n-i[0]-k)%3==0:
            print("yes")
            y=True
            break        
    if not y:
        print("no")

from sys import *

t=int(stdin.readline())
for i in range(t):
    n,k,d1,d2=(int(z) for z in stdin.readline().split())
    vars=((2*d1+d2,2*d2+d1),(2*max(d1,d2)-min(d1,d2),d1+d2))
    y=False
    for i in vars:
        if i[0]<=k and i[0]%3==k%3 and n-k-i[1]>=0 and (n-i[1]-k)%3==0:
            print("yes")
            y=True
            break
        if i[1]<=k and i[1]%3==k%3 and n-k-i[0]>=0 and (n-i[0]-k)%3==0:
            print("yes")
            y=True
            break        
    if not y:
        print("no")

from sys import *

t=int(stdin.readline())
for i in range(t):
    n,k,d1,d2=(int(z) for z in stdin.readline().split())
    if (k-2*d1-d2>=0 and (k-2*d1-d2)%3==0 and n-2*d2-d1-k>=0 and (n-2*d2-d1-k)%3==0) or (k-2*d2-d1>=0 and (k-2*d2-d1)%3==0 and n-2*d1-d2-k>=0 and (n-2*d1-d2-k)%3==0) or (k-d1-d2>=0 and (k-d1-d2)%3==0 and n-2*max(d1,d2)+min(d1,d2)-k>=0 and (n-2*max(d1,d2)+min(d1,d2)-k)%3==0) or (k-2*max(d1,d2)+min(d1,d2)>=0 and (k-2*max(d1,d2)+min(d1,d2))%3==0 and n-d1-d2-k>=0 and (n-d1-d2-k)%3==0):
        print("yes")
    else:
        print("no")

from sys import *

t=int(stdin.readline())
mm=0
for i in range(t):
    n,k,d1,d2=(int(z) for z in stdin.readline().split())
    mm=2*max(d1,d2)-min(d1,d2)
    if (k-2*d1-d2>=0 and (k-2*d1-d2)%3==0 and n-2*d2-d1-k>=0 and (n-2*d2-d1-k)%3==0) or (k-2*d2-d1>=0 and (k-2*d2-d1)%3==0 and n-2*d1-d2-k>=0 and (n-2*d1-d2-k)%3==0) or (k-d1-d2>=0 and (k-d1-d2)%3==0 and n-mm-k>=0 and (n-mm-k)%3==0) or (k-mm>=0 and (k-mm)%3==0 and n-d1-d2-k>=0 and (n-d1-d2-k)%3==0):
        print("yes")
    else:
        print("no")

from sys import *

t=int(stdin.readline())
mm,mmm,mmmm,m=0,0,0,0
for i in range(t):
    n,k,d1,d2=(int(z) for z in stdin.readline().split())
    m=d1+d2
    mm=2*max(d1,d2)-min(d1,d2)
    mmm=2*d1+d2
    mmmm=2*d2+d1
    if (k-mmm>=0 and (k-mmm)%3==0 and n-mmmm-k>=0 and (n-mmmm-k)%3==0) or (k-mmmm>=0 and (k-mmmm)%3==0 and n-mmm-k>=0 and (n-mmm-k)%3==0) or (k-m>=0 and (k-m)%3==0 and n-mm-k>=0 and (n-mm-k)%3==0) or (k-mm>=0 and (k-mm)%3==0 and n-m-k>=0 and (n-m-k)%3==0):
        print("yes")
    else:
        print("no")

t=int(input())
for i in range(t):
    n,k,d1,d2=map(int,input().split())
    m=d1+d2
    mm=2*max(d1,d2)-min(d1,d2)
    mmm=2*d1+d2
    mmmm=2*d2+d1
    if (k-mmm>=0 and (k-mmm)%3==0 and n-mmmm-k>=0 and (n-mmmm-k)%3==0) or (k-mmmm>=0 and (k-mmmm)%3==0 and n-mmm-k>=0 and (n-mmm-k)%3==0) or (k-m>=0 and (k-m)%3==0 and n-mm-k>=0 and (n-mm-k)%3==0) or (k-mm>=0 and (k-mm)%3==0 and n-m-k>=0 and (n-m-k)%3==0):
        print("yes")
    else:
        print("no")

from sys import *

t=int(stdin.readline())
mm=0
for i in range(t):
    n,k,d1,d2=(int(z) for z in stdin.readline().split())
    mm=2*max(d1,d2)-min(d1,d2)
    if (k-2*d1-d2>=0 and (k-2*d1-d2)%3==0 and n-2*d2-d1-k>=0 and (n-2*d2-d1-k)%3==0) or (k-2*d2-d1>=0 and (k-2*d2-d1)%3==0 and n-2*d1-d2-k>=0 and (n-2*d1-d2-k)%3==0) or (k-d1-d2>=0 and (k-d1-d2)%3==0 and n-mm-k>=0 and (n-mm-k)%3==0) or (k-mm>=0 and (k-mm)%3==0 and n-d1-d2-k>=0 and (n-d1-d2-k)%3==0):
        print("yes")
    else:
        print("no")

import sys
def check(a, b, c, n, k):
	need = n // 3
	return ((n - k) == (need - a) + (need - b) + (need - c) and a <= need and b <= need and c <= need and a >= 0 and b >= 0 and c >= 0)

for tc in range(int(sys.stdin.readline())):
	n,k,d1,d2 = map(int, sys.stdin.readline().split())
	if n % 3 != 0:
		print('no')
		continue

	ans = False
	#case++
	a = k - 2 * d1 - d2
	if a % 3 == 0:
		a //= 3
		ans |= check(a, a + d1, a + d1 + d2, n ,k)

	#case+-
	a = k + d2 - 2 * d1
	if a % 3 == 0:
		a //= 3
		ans |= check(a, a + d1, a + d1 - d2, n, k)

	#case--
	a = k + 2 * d1 + d2
	if a % 3 == 0:
		a //= 3
		ans |= check(a, a - d1, a - d1 - d2, n, k)

	#case-+
	a = k - d2 + 2 * d1
	if a % 3 == 0:
		a //= 3
		ans |= check(a, a - d1, a - d1 + d2, n, k)

	print('yes' if ans else 'no')

for i in range(int(input())):

    n, u, a, b = list(map(int, input().split()))

    if n % 3: print('no')

    else:

        if a > b: a, b = b, a

        p, q = a + b, 2 * b - a

        s, r, v = p + a, p + b, n - u

        t = [(p, q), (q, p), (s, r), (r, s)]

        print('no' if all(x > u or (x - u) % 3 or y > v or (y - v) % 3 for x, y in t) else 'yes')



# Made By Mostafa_Khaled


t = int(input())
ret = []
while t>0:
    t-=1
    n,k,d1,d2 = map(int,input().split())

    # ans = []

    y1 = (k-(d1-d2))//3
    x1 = y1+d1
    z1 = y1-d2
    # ans = [y1,z1,x1]
    # ans = sorted(ans)
    # ans1 = 2*ans[2]-(ans[0]+ans[1])
    ans1 = 2*x1-(z1+y1)
    if x1+y1+z1==k and min(z1,y1)>=0 and ans1<=n-k and (n-k-ans1)%3==0:
        ret.append('yes')
        continue
    
    # ans = []

    y1 = (k-(d1+d2))//3
    x1 = y1+d1
    z1 = y1+d2
    if d1>=d2:
        # ans = [y1,z1,x1]
        ans1 = 2*x1-(y1+z1)
    else:
        # ans = [y1,x1,z1]
        ans1 = 2*z1-(y1+x1)
    # ans = sorted(ans)
    # ans1 = 2*ans[2]-(ans[0]+ans[1])
    if x1+y1+z1==k and y1>=0 and ans1<=n-k and (n-k-ans1)%3==0:
        ret.append('yes')
        continue
    
    y1 = (k-(d2-d1))//3
    x1 = y1-d1
    z1 = y1+d2
    # ans = [x1,y1,z1]
    # ans = sorted(ans)
    ans1 = 2*z1-(x1+y1)
    if x1+y1+z1==k and min(x1,y1)>=0 and ans1<=n-k and (n-k-ans1)%3==0:
        ret.append('yes')
        continue
    
    y1 = (k+(d2+d1))//3
    x1 = y1-d1
    z1 = y1-d2
    # ans = [x1,y1,z1]
    # ans = sorted(ans)
    ans1 = 2*y1-(x1+z1)
    if x1+y1+z1==k and min(x1,z1)>=0 and ans1<=n-k and (n-k-ans1)%3==0:
        ret.append('yes')
        continue





    # if d1>=d2:
    #     ans.append(2*d1-d2)
    #     ans.append(d2+2*(d1-d2))
    # else:
    #     ans.append(2*d2-d1)
    #     ans.append(d1+2*(d2-d1))

    # ans+=[d1+2*d2,d2+2*d1,d1+d2]
    # done = False
    # print(ans)
    # for a in ans:
    #     # if (a==0 and (n-k)%3==0) or (a!=0 and (n-k)//a>1 and (n-k)%a==0):
    #     if (a<=n-k) and (n-k-a)%3==0:
    #         print(a)
    #         done = True
    #         break

    # if done:
    #     print('yes')
    # else:
    ret.append('no')

print(*ret, sep = '\n')


import sys
lines = sys.stdin.readlines()

'''
(n, p) = map(int, lines[0].strip().split(" "))
ranges = []
for i in range(1, n+1):
    (l, r) = map(int, lines[i].strip().split(" "))
    ranges.append((l,r))

probs = []
for lr in ranges:
    poss = lr[1]//p - (lr[0]-1)//p
    probs.append(poss/(lr[1]-lr[0]+1))

res = 0
for i in range(n):
    res += probs[i] + probs[i-1] - probs[i] * probs[i-1]
print(res * 2000)
'''
N = int(lines[0].strip())
for i in range(1, 1+N):
    (n, k, d1, d2) = map(int, lines[i].strip().split(" "))
    if n % 3 != 0: print("no"); continue

    def solve(da, db):
        tmp = k - da - db
        if tmp % 3 != 0: return True
        b = tmp // 3
        a = b + da
        c = b + db
        if min(a,b,c) < 0: return True
        if n//3 >= max(a,b,c): return False
        else: return True
        
    cannot = True
    if cannot: cannot = solve(d1, d2)
    if cannot: cannot = solve(d1, -d2)
    if cannot: cannot = solve(-d1, d2)
    if cannot: cannot = solve(-d1, -d2)
    if cannot: print("no")
    else: print("yes")