/**
Monday left me broken
Tuesday I was through with hoping
Wednesday my empty arms were open
Thursday waiting for love, waiting for love
Thank the stars it's Friday
I'm burning like a fire gone wild on Saturday
Guess I won't be coming to church on Sunday
I'll be waiting for love, waiting for love
To come around
**/

#include <bits/stdc++.h>

using namespace std;

typedef pair <long long ,long long>	PII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;

long long INF=1e17;
const int N=5e5+33;
const long long MD=24;

inline long long mul(long long a, long long b){
    return (a*b)%MD;
}

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = mul(ans,a);
        a = mul(a,a);
        b/=2;
    }
    return ans;
}

long long n,m,t,k;
long long arr[N];
long long x;
string s;

int main(){
    ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>arr[i];

	multiset<int> st;
	int ans=0;
	multiset<int>::iterator it=st.end();
	long long sum=0,fi=0;

	for(int i=0;i<n;i++){
		sum+=arr[i];
		//cerr<<sum<<":"<<fi<<endl;
		while(m-sum+fi<0){
			it--;
			ans++;
			//cerr<<*it<<" ";
			fi+=*it;
		}
bool is=0;
		while(st.size()>0 && it!=(--st.end()) && it!=st.end() && m-sum+fi-*(++it)>=0){
			is=1;
			ans--;
			fi-=*it;
			if(!(st.size()>0 && it!=(--st.end()) && it!=st.end())){is=0;break;}
		}

		if(is)it--;

		cout<<ans<<" ";
		st.insert(arr[i]);
		if(it!=st.end() && arr[i]>*it){
			ans++;
			fi+=arr[i];
		}

	}

    return 0;
}


/**
Monday left me broken
Tuesday I was through with hoping
Wednesday my empty arms were open
Thursday waiting for love, waiting for love
Thank the stars it's Friday
I'm burning like a fire gone wild on Saturday
Guess I won't be coming to church on Sunday
I'll be waiting for love, waiting for love
To come around
**/

#include <bits/stdc++.h>

using namespace std;

typedef pair <long long ,long long>	PII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;

long long INF=1e17;
const int N=5e5+33;
const long long MD=24;

inline long long mul(long long a, long long b){
    return (a*b)%MD;
}

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = mul(ans,a);
        a = mul(a,a);
        b/=2;
    }
    return ans;
}

long long n,m,t,k;
long long arr[N];
long long x;
string s;

int main(){
    ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>arr[i];

	multiset<int> st;
	int ans=0;
	multiset<int>::iterator it=st.end();
	long long sum=0,fi=0;

	for(int i=0;i<n;i++){
		sum+=arr[i];
		//cerr<<sum<<endl;
		while(m-sum+fi<0){
			it--;
			ans++;
			fi+=*it;
		}
	bool is=0;
		while(st.size()>0 && it!=(--st.end()) && it!=st.end() && m-sum+fi-*(++it)>0){
			is=1;
			ans--;
			fi-=*it;
		}
		if(is)it--;

		st.insert(arr[i]);
		cout<<ans<<" ";

	}

    return 0;
}


/**
Monday left me broken
Tuesday I was through with hoping
Wednesday my empty arms were open
Thursday waiting for love, waiting for love
Thank the stars it's Friday
I'm burning like a fire gone wild on Saturday
Guess I won't be coming to church on Sunday
I'll be waiting for love, waiting for love
To come around
**/

#include <bits/stdc++.h>

using namespace std;

typedef pair <long long ,long long>	PII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;

long long INF=1e17;
const int N=5e5+33;
const long long MD=24;

inline long long mul(long long a, long long b){
    return (a*b)%MD;
}

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = mul(ans,a);
        a = mul(a,a);
        b/=2;
    }
    return ans;
}

long long n,m,t,k;
long long arr[N];
long long x;
string s;

int j=0;
int main(){
    ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>arr[i];

	multiset<int> st;
	int ans=0;
	multiset<int>::iterator it=st.end();
	long long sum=0,fi=0;

	for(int i=0;i<n;i++){
		sum+=arr[i];
		//cerr<<sum<<":"<<fi<<endl;
		while(m-sum+fi<0){
		j--;	it--;
			ans++;
			//cerr<<*it<<" ";
			fi+=*it;
		}
		while(it!=st.end() && m-sum+fi-*(it)>=0){
			ans--;
			fi-=*it;
			it++;
		}

		cout<<ans<<" ";
		st.insert(arr[i]);
		if(it!=st.end() && arr[i]>=*it){
			ans++;
			fi+=arr[i];
		}

	}

    return 0;
}


/**
Monday left me broken
Tuesday I was through with hoping
Wednesday my empty arms were open
Thursday waiting for love, waiting for love
Thank the stars it's Friday
I'm burning like a fire gone wild on Saturday
Guess I won't be coming to church on Sunday
I'll be waiting for love, waiting for love
To come around
**/

#include <bits/stdc++.h>

using namespace std;

typedef pair <long long ,long long>	PII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;

long long INF=1e17;
const int N=5e5+33;
const long long MD=24;

inline long long mul(long long a, long long b){
    return (a*b)%MD;
}

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = mul(ans,a);
        a = mul(a,a);
        b/=2;
    }
    return ans;
}

long long n,m,t,k;
long long arr[N];
long long x;
string s;

int j=0;
int main(){
    ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>arr[i];

	multiset<int> st;
	int ans=0;
	multiset<int>::iterator it=st.end();
	long long sum=0,fi=0;

	for(int i=0;i<n;i++){
		sum+=arr[i];
		//cerr<<sum<<":"<<fi<<endl;
		while(m-sum+fi<0){
		j--;	it--;
			ans++;
			//cerr<<*it<<" ";
			fi+=*it;
		}
bool is=0;
		while(st.size()>0 && it!=(--st.end()) && it!=st.end() && m-sum+fi-*(++it)>=0){
		j++;	is=1;
			ans--;
			fi-=*it;
			if(!(st.size()>0 && it!=(--st.end()) && it!=st.end())){is=0;break;}
		}

		if(is)it--,j--;

		cout<<ans<<" ";
		st.insert(arr[i]);
		if(it!=st.end() && arr[i]>*it){
			ans++;
			fi+=arr[i];
		}

	}

    return 0;
}


#include<bits/stdc++.h>
#define mp make_pair
#define lli long long int
#define ulli unsigned long long int
#define dout if(debug)cout<<" "
#define mod 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  int N, M;
  cin >> N >> M;
  int arr[N];
  int sum = 0;
  vector<int>sorted_arr;
  vector<int> :: iterator it;
  for(int i = 0; i < N; i++){
    cin >> arr[i];
  }

  for(int i = 0; i < N; i++){
    sum += arr[i];
    int temp_sum = sum;
    int count = 0;
    vector<int>temp;
    while(temp_sum > M){
      temp_sum -= sorted_arr.front();
      count++;
      temp.push_back(sorted_arr.front());
      pop_heap(sorted_arr.begin(), sorted_arr.end());
      sorted_arr.pop_back();
    }

    for(int i = 0; i < temp.size(); i++){
      sorted_arr.push_back(temp[i]);
    }
    cout << count << " ";
    sorted_arr.push_back(arr[i]);
    if(i == 0)
      make_heap(sorted_arr.begin(), sorted_arr.end());
    else
      push_heap(sorted_arr.begin(), sorted_arr.end());
  }
	return 0;
}
//Hi there Sourav Sahoo please use lli instead of int


#include<bits/stdc++.h>
#define mp make_pair
#define lli long long int
#define ulli unsigned long long int
#define dout if(debug)cout<<" "
#define mod 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  int N, M;
  cin >> N >> M;
  int arr[N];
  int sum = 0;
  vector<int>sorted_arr;
  vector<int> :: iterator it;
  for(int i = 0; i < N; i++){
    cin >> arr[i];
  }

  for(int i = 0; i < N; i++){
    sum += arr[i];
    int temp_sum = sum;
    int count = 0;
    vector<int>temp;
    while(temp_sum > M){
      temp_sum -= sorted_arr.front();
      count++;
      temp.push_back(sorted_arr.front());
      pop_heap(sorted_arr.begin(), sorted_arr.end());
      sorted_arr.pop_back();
    }

    for(int i = 0; i < temp.size(); i++){
      sorted_arr.push_back(temp[i]);
      push_heap(sorted_arr.begin(), sorted_arr.end());
    }
    cout << count << " ";
    sorted_arr.push_back(arr[i]);
    if(i == 0)
      make_heap(sorted_arr.begin(), sorted_arr.end());
    else
      push_heap(sorted_arr.begin(), sorted_arr.end());
  }
	return 0;
}
//Hi there Sourav Sahoo please use lli instead of int


#include<bits/stdc++.h>
#define mp make_pair
#define lli long long int
#define ulli unsigned long long int
#define dout if(debug)cout<<" "
#define mod 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  int N, M;
  cin >> N >> M;
  int arr[N];
  for(int i = 0; i < N; i++){
    cin >> arr[i];
  }

  int cnt[100] = {0};
  for(int i = 0; i < N; i++){
    int sum = arr[i];
    int count = 0;
    for(int j = 1; j <= 100; j++){
      sum += cnt[j]*j;
      if(sum > M){
        sum -= cnt[j]*j;
        for(int k = 1; k <= cnt[j]; k++){
          sum += j;
          if(sum > M){
            break;
          }

          else if(sum == M){
            count++;
            break;
          }

          count++;
        }
      }

      else if(sum == M){
        count += cnt[j];
        break;
      }

      else{
        count += cnt[j];
      }

    }
    cnt[arr[i]]++;
    cout << i-count << " ";
  }
	return 0;
}
//Hi there Sourav Sahoo please use lli instead of int


#include<bits/stdc++.h>
#define mp make_pair
#define lli long long int
#define ulli unsigned long long int
#define dout if(debug)cout<<" "
#define mod 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  int N, M;
  cin >> N >> M;
  int arr[N];
  int sum = 0;
  vector<int>sorted_arr;
  vector<int> :: iterator it;
  for(int i = 0; i < N; i++){
    cin >> arr[i];
  }

  for(int i = 0; i < N; i++){
    sum += arr[i];
    int temp_sum = sum;
    int count = 0;
    vector<int>temp;
    while(temp_sum > M){
      temp_sum -= sorted_arr.front();
      count++;
      temp.push_back(sorted_arr.front());
      pop_heap(sorted_arr.begin(), sorted_arr.end());
      sorted_arr.pop_back();
      make_heap(sorted_arr.begin(), sorted_arr.end());
    }

    for(int i = 0; i < temp.size(); i++){
      sorted_arr.push_back(temp[i]);
    }
    cout << count << " ";
    sorted_arr.push_back(arr[i]);
    make_heap(sorted_arr.begin(), sorted_arr.end());

  }
	return 0;
}
//Hi there Sourav Sahoo please use lli instead of int


#include<bits/stdc++.h>
#define mp make_pair
#define lli long long int
#define ulli unsigned long long int
#define dout if(debug)cout<<" "
#define mod 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  int N, M;
  cin >> N >> M;
  int arr[N];
  int sum = 0;
  vector<int>sorted_arr;
  vector<int> :: iterator it;
  for(int i = 0; i < N; i++){
    cin >> arr[i];
  }

  int count = 0;
  for(int i = 0; i < N; i++){
    sum += arr[i];
    int temp_sum = sum;
    it = sorted_arr.end();
    while(sum > M){
      it--;
      sum -= *it;
      sorted_arr.erase(it);
      count++;
    }
    cout << count << " ";
    sorted_arr.push_back(arr[i]);
    sort(sorted_arr.begin(), sorted_arr.end());

  }
	return 0;
}
//Hi there Sourav Sahoo please use lli instead of int


#include<bits/stdc++.h>
#define mp make_pair
#define lli long long int
#define ulli unsigned long long int
#define dout if(debug)cout<<" "
#define mod 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  int N, M;
  cin >> N >> M;
  int arr[N];
  int sum = 0;
  vector<int>sorted_arr;
  vector<int> :: iterator it;
  for(int i = 0; i < N; i++){
    cin >> arr[i];
  }

  for(int i = 0; i < N; i++){
    sum += arr[i];
    int temp_sum = sum;
    int count = 0;
    it = sorted_arr.end();
    while(temp_sum > M){
      it--;
      temp_sum -= *it;
      count++;
    }
    cout << count << " ";
    sorted_arr.push_back(arr[i]);
    sort(sorted_arr.begin(), sorted_arr.end());

  }
	return 0;
}
//Hi there Sourav Sahoo please use lli instead of int


#include<bits/stdc++.h>
#define mp make_pair
#define lli long long int
#define ulli unsigned long long int
#define dout if(debug)cout<<" "
#define mod 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  int N, M;
  cin >> N >> M;
  int arr[N];
  for(int i = 0; i < N; i++){
    cin >> arr[i];
  }

  int cnt[101] = {0};
  for(int i = 0; i < N; i++){
    int sum = arr[i];
    int count = 0;
    for(int j = 1; j <= 100; j++){
      sum += cnt[j]*j;
      if(sum > M){
        sum -= cnt[j]*j;
        for(int k = 1; k <= cnt[j]; k++){
          sum += j;
          if(sum > M){
            break;
          }

          else if(sum == M){
            count++;
            break;
          }

          count++;
        }
      }

      else if(sum == M){
        count += cnt[j];
        break;
      }

      else{
        count += cnt[j];
      }

    }
    cnt[arr[i]]++;
    cout << i-count << " ";
  }
	return 0;
}
//Hi there Sourav Sahoo please use lli instead of int


#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> plli;
typedef vector< vi > vvi ;
typedef vector< vlli > vvlli  ;
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define flli(i,a,b) for(long long int i=a;i<=b;i++)
#define bi(i,a,b) for(int i=a;i>=b;i--)
#define blli(i,a,b) for(long long int i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pi 2*acos(0.0)
#define pb push_back
#define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
#define present(v,num) (v.find(num)!=v.end())
#define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
#define pq priority_queue
#define mp make_pair
const int inf=INT_MAX;
const lli INF =LLONG_MAX;
const lli mod = 1e9+7;
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n,m;scanf("%d %d", &n, &m);
    vi counta(101,0);
    lli sum=0;
    fi(i,0,n-1)
    {
    	int temp;scanf("%d",&temp);
    	lli curr=temp;
    	lli count=0;
    	fi(j,1,100)
    	{
    		if(counta[j]==0)continue;
    		int var=(m-curr)/j;
    		int temp1=max(0,min(var,counta[j]));
    		curr+=temp1*j;
    		count+=temp1;
    	}
    	counta[temp]++;
    	count++;
    	cout<<i+1-count<<" ";
    }
    //cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> plli;
typedef vector< vi > vvi ;
typedef vector< vlli > vvlli  ;
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define flli(i,a,b) for(long long int i=a;i<=b;i++)
#define bi(i,a,b) for(int i=a;i>=b;i--)
#define blli(i,a,b) for(long long int i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pi 2*acos(0.0)
#define pb push_back
#define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
#define present(v,num) (v.find(num)!=v.end())
#define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
#define pq priority_queue
#define mp make_pair
const int inf=INT_MAX;
const lli INF =LLONG_MAX;
const lli mod = 1e9+7;
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int n,m;scanf("%d %d", &n, &m);
    vi counta(101,0);
    vi countb(101,0);
    lli sum=0;
    fi(i,0,n-1)
    {
    	int temp;scanf("%d",&temp);
    	sum+=temp;
    	bool flag=false;
    	fi(j,1,100)
    	{
    		if(sum>=m)break;
    		if(countb[j]==0)continue;
    		int temp1=(m-sum)/j;
    		temp1=min(countb[j],temp1);
    		sum+=temp1*j;
    		counta[j]+=temp1;
    		countb[j]-=temp1;
    	}
    	bi(j,100,1)
    	{
    		if(sum<=m)break;
    		if(counta[j]==0)continue;
    		int temp1=(sum-m)/j;
    		temp1=min(counta[j],temp1);
    		sum-=temp1*j;
    		counta[j]-=temp1;
    		countb[j]+=temp1;
    		if(sum>m && counta[j]>0)
    		{
    			sum-=j;
    			counta[j]--;
    			countb[j]++;
    		}
    	}
    	counta[temp]++;
    	int count=0;
    	fi(j,1,100)count+=counta[j];
    	int ans=i+1-count;
    	printf("%d ",ans);
    	int var=0;
    	flag=false;
    	fi(j,1,100)
    	{
    		if(countb[j]==0)continue;
    		if(var+j<=temp)
    		{
    			int temp1=(temp-var)/j;
    			temp1=min(countb[j],temp1);
    			var+=temp1*j;
    			sum+=temp1*j;
    			counta[temp1]+=temp1;
    			countb[temp1]-=temp1;
    			flag=true;
    		}
    	}
    	if(flag)
    	{
    		counta[temp]--;
    		sum-=temp;
    		countb[temp]++;
    	}
    }
    //cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    int t;
    cin >> t;
    for(long long n, k, d1, d2, temp; cin >> n >> k >> d1 >> d2; ) {
        temp = k - 2 * d1 - d2;
        if(temp >= 0 && temp % 3 == 0) {
            temp = n - k - d1 - 2 * d2;
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - d2;
        if(temp >= 0 && temp % 3 == 0) {
            temp = n - k - 2 * max(d1, d2) + min(d1, d2);
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - 2 * d1 + d2;
        if(temp >= 0 && temp % 3 == 0) {
        	auto c = temp / 3 + d1 - d2;
            temp = n - k - d1 - d2;
            if(c >= 0 && temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - 2 * d2;
        if(temp >= 0 && temp % 3 == 0) {
            temp = n - k - 2 * d1 - d2;
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        cout << "no" << endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    int t;
    cin >> t;
    for(long long n, k, d1, d2, a, b, c, temp; cin >> n >> k >> d1 >> d2; ) {
        temp = k - d1 - d1 + d2;
        if(temp >= 0 && temp % 3 == 0) {
            a = temp / 3;
            b = d1 + a;
            c = d2 + b;
            temp = n - k - d1 - d2 - d2;
            if(a - b <= 0 && b - c <= 0 && temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - d2;
        if(temp >= 0 && temp % 3 == 0) {
            b = temp / 3;
            a = d1 + b;
            c = d2 + b;
            temp = n - k - 2 * max(d1, d2) + min(d1, d2);
            if(a - b >= 0 && b - c <= 0 && temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k + d2 - d1 - d1;
        if(temp >= 0 && temp % 3 == 0) {
            a = temp / 3;
            b = d1 + a;
            c = b - d2;
            temp = n - k - d1 - d2;
            if(a - b <= 0 && b - c >= 0 && temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - 3 * d2;
        if(temp >= 0 && temp % 3 == 0) {
            c = temp / 3;
            b = d2 + c;
            a = d1 + b;
            temp = n - k - d2 - d1 - d1;
            if(a - b >= 0 && b - c >= 0 && temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        cout << "no" << endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    int t;
    cin >> t;
    for(long long n, k, d1, d2, a, b, c, temp; cin >> n >> k >> d1 >> d2; ) {
        temp = k - d1 - d1 + d2;
        if(temp % 3 == 0) {
            a = temp / 3;
            b = d1 + a;
            c = d2 + b;
            temp = n - k - d1 - 2 * d2;
            if(a >= 0 && b >= 0 && c >= 0 && temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - d2;
        if(temp % 3 == 0) {
            b = temp / 3;
            a = d1 + b;
            c = d2 + b;
            temp = n - k - min(d1, d2) - 2 * (max(d1, d2) - min(d1, d2));
            if(a >= 0 && b >= 0 && c >= 0 && temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k + d2 - d1 - d1;
        if(temp % 3 == 0) {
            a = temp / 3;
            b = d1 + a;
            c = b - d2;
            temp = n - k - d1 - d2;
            if(a >= 0 && b >= 0 && c >= 0 && temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - 3 * d2;
        if(temp % 3 == 0) {
            c = temp / 3;
            b = d2 + c;
            a = d1 + b;
            if(a >= 0 && b >= 0 && c >= 0 && d1 + 2 * d1 <= n - k && (n - k - d1 - 2 * d2) % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        cout << "no" << endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    int t;
    cin >> t;
    for(long long n, k, d1, d2; cin >> n >> k >> d1 >> d2; ) {
        if(d1 > d2)
            swap(d1, d2);
        auto diff = n - k - d2 - d2 + d1;
        if(diff >= 0 && diff % 3 == 0)
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    int t;
    cin >> t;
    for(long long n, k, d1, d2, a, b, c, temp; cin >> n >> k >> d1 >> d2; ) {
        temp = k - 2 * d1 - d2;
        if(temp >= 0 && temp % 3 == 0) {
            a = temp / 3;
            b = d1 + a;
            c = d2 + b;
            temp = n - k - d1 - 2 * d2;
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - d2;
        if(temp >= 0 && temp % 3 == 0) {
            b = temp / 3;
            a = d1 + b;
            c = d2 + b;
            temp = n - k - 2 * max(d1, d2) + min(d1, d2);
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - 2 * d1 + d2;
        if(temp >= 0 && temp % 3 == 0) {
            a = temp / 3;
            b = d1 + a;
            c = b - d2;
            temp = n - k - d1 - d2;
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 + d2;
        if(temp >= 0 && temp % 3 == 0) {
            b = temp / 3;
            a = d1 + b;
            c = b - d2;
            temp = n - k - 2 * d1 - d2;
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        cout << "no" << endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    int t;
    cin >> t;
    for(long long n, k, d1, d2, a, b, c, temp; cin >> n >> k >> d1 >> d2; ) {
        temp = k - 2 * d1 - d2;
        if(temp >= 0 && temp % 3 == 0) {
            a = temp / 3;
            b = d1 + a;
            c = d2 + b;
            temp = n - k - d1 - 2 * d2;
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - d2;
        if(temp >= 0 && temp % 3 == 0) {
            b = temp / 3;
            a = d1 + b;
            c = d2 + b;
            temp = n - k - 2 * max(d1, d2) + min(d1, d2);
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k + d1 - 2 * d2;
        if(temp >= 0 && temp % 3 == 0) {
            c = temp / 3;
            b = d2 + c;
            a = b - d1;
            temp = n - k - d1 - d2;
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - 2 * d2;
        if(temp >= 0 && temp % 3 == 0) {
            c = temp / 3;
            b = d2 + c;
            a = d1 + b;
            temp = n - k - 2 * d1 - d2;
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        cout << "no" << endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    int t;
    cin >> t;
    for(long long n, k, d1, d2, a, b, c, temp; cin >> n >> k >> d1 >> d2; ) {
        temp = k - 2 * d1 - d2;
        if(temp >= 0 && temp % 3 == 0) {
            a = temp / 3;
            b = d1 + a;
            c = d2 + b;
            temp = n - k - d1 - 2 * d2;
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - d2;
        if(temp >= 0 && temp % 3 == 0) {
            b = temp / 3;
            a = d1 + b;
            c = d2 + b;
            temp = n - k - 2 * max(d1, d2) + min(d1, d2);
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - 2 * d1 + d2;
        if(temp >= 0 && temp % 3 == 0) {
            a = temp / 3;
            b = d1 + a;
            c = b - d2;
            temp = n - k - d1 - d2;
            if(c >= 0 && temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        temp = k - d1 - 2 * d2;
        if(temp >= 0 && temp % 3 == 0) {
            c = temp / 3;
            b = d2 + c;
            a = d1 + b;
            temp = n - k - 2 * d1 - d2;
            if(temp >= 0 && temp % 3 == 0) {
                cout << "yes" << endl;
                continue;
            }
        }
        cout << "no" << endl;
    }
    return 0;
}


#include <iostream>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;

typedef tree<pair<long long int,long long int>,null_type,less<pair<long long int,long long int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

void go()
{
    long long int n,k,d1,d2;
    cin>>n>>k>>d1>>d2;
    //for x1>x2>x3
    if(n%3 != 0)
    {
        cout<<"no"<<endl;
        return;
    }
    long long int x1=(k+d2+2*d1)/3;
    long long int x2=(k+d2-d1)/3;
    long long int x3=(k-2*d2 - d1)/3;
    if(x1>=0 && x1<=n/3 && x2>=0 && x2<=n/3 && x3>=0 && x3<=n/3 && x1+x2+x3 == k)
    {
        cout<<"yes"<<endl;
        return;
    }
    x1=(k-d2+2*d1)/3;
    x2=(k-d2-d1)/3;
    x3=(k+2*d2-d1)/3;
    if(x1>=0 && x1<=n/3 && x2>=0 && x2<=n/3 && x3>=0 && x3<=n/3 &&  x1+x2+x3 == k)
    {
        cout<<"yes"<<endl;
        return;
    }
    x1=(k+d2-2*d1)/3;
    x2=(k+d2+d1)/3;
    x3=(k-2*d2+d1)/3;
    if(x1>=0 && x1<=n/3 && x2>=0 && x2<=n/3 && x3>=0 && x3<=n/3 &&  x1+x2+x3 == k)
    {
        cout<<"yes"<<endl;
        return;
    }
    x1=(k-d2-2*d1)/3;
    x2=(k-d2+d1)/3;
    x3=(k+2*d2+d1)/3;
    if(x1>=0 && x1<=n/3 && x2>=0 && x2<=n/3 && x3>=0 && x3<=n/3 && x1+x2+x3 == k)
    {
        cout<<"yes"<<endl;
        return;
    }
    cout<<"no"<<endl;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    go();
    return 0;
}


#include <iostream>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;

typedef tree<pair<long long int,long long int>,null_type,less<pair<long long int,long long int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

void go()
{
    int n,k,d1,d2;
    cin>>n>>k>>d1>>d2;
    //for x1>x2>x3
    int x1=(k+d2+2*d1)/3;
    int x2=(k+d2-d1)/3;
    int x3=(k-2*d2 - d1)/3;
    if(x1>=0 && x1<=n/3 && x2>=0 && x2<=n/3 && x3>=0 && x3<=n/3 && x1+x2+x3 == k)
    {
        cout<<"yes"<<endl;
        return;
    }
    x1=(k-d2+2*d1)/3;
    x2=(k-d2-d1)/3;
    x3=(k+2*d2-d1)/3;
    if(x1>=0 && x1<=n/3 && x2>=0 && x2<=n/3 && x3>=0 && x3<=n/3 &&  x1+x2+x3 == k)
    {
        cout<<"yes"<<endl;
        return;
    }
    x1=(k+d2-2*d1)/3;
    x2=(k+d2+d1)/3;
    x3=(k-2*d2+d1)/3;
    if(x1>=0 && x1<=n/3 && x2>=0 && x2<=n/3 && x3>=0 && x3<=n/3 &&  x1+x2+x3 == k)
    {
        cout<<"yes"<<endl;
        return;
    }
    x1=(k-d2-2*d1)/3;
    x2=(k-d2+d1)/3;
    x3=(k+2*d2+d1)/3;
    if(x1>=0 && x1<=n/3 && x2>=0 && x2<=n/3 && x3>=0 && x3<=n/3 && x1+x2+x3 == k)
    {
        cout<<"yes"<<endl;
        return;
    }
    cout<<"no"<<endl;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    go();
    return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c,cnt,T;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d1;
	int t = n-k;
	t -= a-b;
	t -= a-c;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 || a+b+c != k )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	//~ printf("%d %d %d\n",a,b,c);
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);
	//~ if ( cnt == 57 )
		//~ printf("--> %d %d %d %d\n",n,k,d1,d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}

	puts("no");
}

int main()
{
	int testcase;
	T = testcase;

	cin >> testcase;

	while ( testcase-- ){
		cnt++;
		solve();
	}

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c,cnt,T;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d1;
	int t = n-k;
	t -= a-b;
	t -= a-c;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 || a+b+c != k )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	//~ printf("%d %d %d\n",a,b,c);
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);
	//~ if ( T == 100000 &&  )
		//~ printf("--> %d %d %d %d\n",n,k,d1,d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}
	if ( T == 100000 && cnt == 1923  )
		printf("--> %d %d %d %d\n",n,k,d1,d2);
	puts("no");
}

int main()
{
	int testcase;
	T = testcase;

	cin >> testcase;

	while ( testcase-- ){
		cnt++;
		solve();
	}

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d2+d1;
	int t = n-k;
	t -= d2+d1;
	t -= d1;
	if ( t < 0 || t%3 != 0 )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0  )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}

	puts("no");
}

int main()
{
	int testcase;

	cin >> testcase;

	while ( testcase-- )
		solve();

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c,cnt,T;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d1;
	int t = n-k;
	t -= a-b;
	t -= a-c;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 || a+b+c != k )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	//~ printf("%d %d %d\n",a,b,c);
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);
	//~ if ( T == 100000 &&  )
		//~ printf("--> %d %d %d %d\n",n,k,d1,d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}
	if ( T == 100000 && cnt >= 1922  )
		printf("--> %d %d %d %d\n",n,k,d1,d2);
	puts("no");
}

int main()
{
	int testcase;

	cin >> testcase;
	T = testcase;

	while ( testcase-- ){
		cnt++;
		solve();
	}

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c,cnt,T;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d2+d1;
	int t = n-k;
	t -= d2+d1;
	t -= d1;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 || a+b+c != k )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	//~ printf("%d %d %d\n",a,b,c);
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);
	//~ if ( cnt ==1923 && T == 100000 )
		//~ printf("--> %d %d %d %d\n",n,k,d1,d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}

	puts("no");
}

int main()
{
	int testcase;
	T = testcase;

	cin >> testcase;

	while ( testcase-- ){
		cnt++;
		solve();
	}

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3;

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);
	int t = n-k;
	// a-b , b - c;
	d3 = d1+d2;
	t -= d3;
	t -= d1;
	if ( (k-(d3+d2)) >= 0 && (k-(d3+d1))%3 == 0 && t >= 0 && t%3 ==0 ){
		puts("yes");
		return ;
	}

	// a-b , c - b;
	t = n-k;
	d3 = abs(d1 - d2);
	t -= max(d1,d2);
	t -= d3;
	if ( (k-(d1+d2)) >= 0 &&  (k-(d1+d2))%3 == 0 && t >= 0 && t%3 == 0 ){
		puts("yes");
		return ;
	}

	// b-a , b - c;
	t = n-k;
	t -= d1;
	t -= d2;
	if ( (k-(max(d1,d2)+abs(d1-d2))) >= 0 && (k-(max(d1,d2)+abs(d1-d2))) % 3 == 0 &&  t >= 0 && t%3 == 0 ){
		puts("yes");
		return ;
	}

	// b-a , c - b;
	t = n-k;
	t -= d1+d2;
	t -= d2;
	if ( (k-(d1+d1+d2)) >= 0 && (k-(d1+d1+d2))%3 == 0 && t >= 0 && t%3 == 0 ){
		puts("yes");
		return ;
	}

	puts("no");
}

int main()
{
	int testcase;

	cin >> testcase;

	while ( testcase-- )
		solve();

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d2+d1;
	int t = n-k;
	t -= d2+d1;
	t -= d1;
	if ( t < 0 || t%3 != 0 )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0  )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	//~ printf("%d %d %d\n",a,b,c);
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}

	puts("no");
}

int main()
{
	int testcase;

	cin >> testcase;

	while ( testcase-- )
		solve();

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c,cnt,T;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d1;
	int t = n-k;
	t -= a-b;
	t -= a-c;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 || a+b+c != k )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	//~ printf("%d %d %d\n",a,b,c);
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);
	//~ if ( T == 100000 &&  )
		//~ printf("--> %d %d %d %d\n",n,k,d1,d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}
	if ( T == 100000 && cnt == 1923  )
		printf("--> %d %d %d %d\n",n,k,d1,d2);
	puts("no");
}

int main()
{
	int testcase;

	cin >> testcase;
	T = testcase;

	while ( testcase-- ){
		cnt++;
		solve();
	}

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c,cnt,T;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d2+d1;
	int t = n-k;
	t -= d2+d1;
	t -= d1;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 || a+b+c != k )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	//~ printf("%d %d %d\n",a,b,c);
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);
	if ( cnt == 57 )
		printf("--> %d %d %d %d\n",n,k,d1,d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}

	puts("no");
}

int main()
{
	int testcase;
	T = testcase;

	cin >> testcase;

	while ( testcase-- ){
		cnt++;
		solve();
	}

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c,cnt,T;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d2+d1;
	int t = n-k;
	t -= d2+d1;
	t -= d1;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 || a+b+c != k )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	//~ printf("%d %d %d\n",a,b,c);
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);
	//~ if ( cnt == 57 )
		//~ printf("--> %d %d %d %d\n",n,k,d1,d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}

	puts("no");
}

int main()
{
	int testcase;
	T = testcase;

	cin >> testcase;

	while ( testcase-- ){
		cnt++;
		solve();
	}

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c,cnt;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d2+d1;
	int t = n-k;
	t -= d2+d1;
	t -= d1;
	if ( t < 0 || t%3 != 0 )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0  )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	//~ printf("%d %d %d\n",a,b,c);
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);
	if ( cnt ==1923 )
		printf("--> %d %d %d %d\n",n,k,d1,d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}

	puts("no");
}

int main()
{
	int testcase;

	cin >> testcase;

	while ( testcase-- ){
		cnt++;
		solve();
	}

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

Lint n,k,d1,d2,d3,a,b,c,cnt,T;

bool f1(){
	Lint k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d1;
	Lint t = n-k;
	t -= a-b;
	t -= a-c;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f2(){
	Lint k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	Lint t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

bool f3(){
	Lint k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	Lint t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 || a+b+c != k )
		return false;
	return true;
}

bool f4(){
	Lint k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	Lint t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 || a + b + c != k )
		return false;
	return true;
}

void solve(){
	scanf("%lld %lld %lld %lld",&n,&k,&d1,&d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}
	puts("no");
}

int main()
{
	int testcase;

	cin >> testcase;
	T = testcase;

	while ( testcase-- ){
		cnt++;
		solve();
	}

	return 0;
}


// Bismillahirrahmanirrahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int Lint;
typedef pair < int , int > pii;
typedef pair < int , pii > piii;

#define foreach(_i,x)  for(__typeof(x.begin()) _i=x.begin() ; _i != x.end() ; _i++)
#define yeral() (struct node *)calloc(1,sizeof(struct node))
#define bug printf("#NOOOOO#\n")
#define all(x) x.begin(),x.end()
#define mid ((l+r)/2)
#define pb push_back
#define mp make_pair
#define sc second
#define ft first

inline int read(){ int _x; scanf("%d",&_x); return _x; }

const int INF  = (int) 1e9;
const int mod  = (int) 1e9+7;
const int maxn = (int) 1e5+5;
const int logn = 20;

int n,k,d1,d2,d3,a,b,c,cnt,T;

bool f1(){
	int k2 = k-(d2+d2+d1);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	c = k2/3;
	b = k2/3+d2;
	a = k2/3+d2+d2+d1;
	int t = n-k;
	t -= d2+d1;
	t -= d1;
	if ( t < 0 || t%3 != 0 )
		return false;
	return true;
}

bool f2(){
	int k2 = k-(d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	b = k2/3;
	a = k2/3+d1;
	c = k2/3+d2;
	if ( c > a )
		swap ( a , c );
	int t = n-k;
	t -= a-c;
	t -= a-b;
	if ( t < 0 || t%3 != 0  )
		return false;
	return true;
}

bool f3(){
	int k2 = k+d1+d2;
	if ( k2 %3 != 0 )
		return false;
	b = k2/3;
	a = b-d1;
	c = b-d2;
	if ( c > a )
		swap(a,c);
	int t = n-k;
	t -= b-a;
	t -= b-c;
	if ( t < 0 || t%3 != 0 || a < 0 || b < 0 || c < 0 )
		return false;
	return true;
}

bool f4(){
	int k2 = k-(d1+d1+d2);
	if ( k2 < 0 || k2%3 != 0 )
		return false;
	a = k2/3;
	b = a+d1;
	c = b+d2;
	//~ printf("%d %d %d\n",a,b,c);
	int t = n-k;
	t -= c-b;
	t -= c-a;
	if ( t < 0 || t%3 != 0 )
		return false;
	return true;
}

void solve(){
	scanf("%d %d %d %d",&n,&k,&d1,&d2);
	if ( cnt ==1923 && T == 100000 )
		printf("--> %d %d %d %d\n",n,k,d1,d2);

	if ( f1() ){
		puts("yes");
		return ;
	}

	if ( f2() ){
		puts("yes");
		return ;
	}

	if ( f3() ){
		puts("yes");
		return ;
	}
	if ( f4() ){
		puts("yes");
		return ;
	}

	puts("no");
}

int main()
{
	int testcase;
	T = testcase;

	cin >> testcase;

	while ( testcase-- ){
		cnt++;
		solve();
	}

	return 0;
}


#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>

const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define   endl    '\n'
#define   sl(n)     scanf("%lld",&n)
#define   mp      make_pair
#define   pb      push_back
#define   ppb     pop_back
#define   fi      first
#define   se      second
#define   ll      long long
#define   ull     unsigned long long
#define   ld      long double
#define   pii     pair<int, int>
#define   f(i,a,b)  for(ll i = (ll)(a); i < (ll)(b); i++)
#define   rf(i,a,b)   for(ll i = (ll)(a); i > (ll)(b); i--)
#define   ms(a,b)   memset((a),(b),sizeof(a))
#define   abs(x)    ((x<0)?(-(x)):(x))
#define   MAX     1000005
#define   inf     LLONG_MAX
#define   ninf    LLONG_MIN
#define   MIN     INT_MIN
# define M_PI           3.14159265358979323846
#define   yeet    return 0;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long  b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

//typedef
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int mod = 1e9 +7 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}

inline int addMod(int a, int b, int m = mod) {return ((int64_t)a + b) % m;}
inline int mulMod(int a, int b, int m = mod) {  return ((int64_t)a * b) % m;}
inline int divMod(int a, int b, int m = mod) {int64_t x, y;int64_t g = extGcd(b, m, x, y);if (g != 1) {cerr << "Bad gcd!" << endl;for (;;);}x = (x % m + m) % m;return mulMod(a, x, m);}

inline ll exp(ll a,ll b){if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=r*(a%mod);r=(r+mod)%mod;}b/=2;a=(a%mod)*(a%mod);a=(a+mod)%mod;}return (r+mod)%mod;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }
// ll f[MAX];
// ll iv[MAX];
// ll C(ll n,ll r){
// 	 if(n<r)return 0;
// 	 ll ans=(f[n]%mod * iv[r]%mod)%mod;
// 	 ans=(ans%mod * iv[n-r]%mod)%mod;
// 	 return ans%mod;
// }
// void init(){
// 	 f[0]=1;
//      iv[0]=1;
//      f(i,1,MAX)f[i]=(i*f[i-1])%mod;
//      iv[MAX-1]=exp(f[MAX-1],mod-2);

//      for(int i=MAX-2;i>=0;--i)iv[i]=(iv[i+1]*(i+1))%mod;

// }

///* seive */  const int N= 10000000;int lp[N+1];vector<int> pr;void seive(){for (int i=2; i<=N; ++i) {if (lp[i] == 0) {lp[i] = i;pr.push_back (i);}for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j) lp[i * pr[j]] = pr[j]; }}
////****************************************************************************************************************************************************************************************************************////
 bool fourtimesImp(ll n,ll k,ll D1, ll D2){
             for(int sgn=-1;sgn<=1;sgn++){
             	 for(int sgn2=-1;sgn2<=1;sgn2++){
             	 	   if(sgn ==0  or sgn2==0 )continue;
             	 	   ll d1= sgn*D1;
             	 	   ll d2= sgn2*D2;
             	 	   ll x2;
             	 	   if( (k+d1-d2)%3 !=0)continue;
             	 	   else x2= (k+d1-d2)/3;
             	 	   if(x2>=0 and x2<=k){
             	 	   	ll x1=x2-d1;
             	 	   	ll x3=x2+d2;
             	 	   	if(x1>=0 and x1<=k and x3>=0 and x3<=k){
             	 	   		 if(x1<= n/3 and x2<= n/3 and x3 <= n/3){
                             assert(abs(x2-x1) ==D1);
                             assert(abs(x2-x3)==D2);
             	 	   		 	 return true;
             	 	   		 }
             	 	   	}

             	 	   }

             	 }
             }
             return false;
 }
 int main(){
 	   int t;
 	   cin>>t;
 	    while(t--){
 	    	  ll n,k,d1,d2;
 	    	  cin>>n>>k>>d1>>d2;
 	    	  if(n%3 !=0){cout<<"no"<<endl;continue;}
 	    	  bool ans=fourtimesImp(n,k,d1,d2);
 	    	  if(ans)cout<<"yes"<<endl;
 	    	  else cout<<"no"<<endl;
 	    }

 	return 0;
 }


#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>

const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define   endl    '\n'
#define   sl(n)     scanf("%lld",&n)
#define   mp      make_pair
#define   pb      push_back
#define   ppb     pop_back
#define   fi      first
#define   se      second
#define   ll      long long
#define   ull     unsigned long long
#define   ld      long double
#define   pii     pair<int, int>
#define   f(i,a,b)  for(ll i = (ll)(a); i < (ll)(b); i++)
#define   rf(i,a,b)   for(ll i = (ll)(a); i > (ll)(b); i--)
#define   ms(a,b)   memset((a),(b),sizeof(a))
#define   abs(x)    ((x<0)?(-(x)):(x))
#define   MAX     1000005
#define   inf     LLONG_MAX
#define   ninf    LLONG_MIN
#define   MIN     INT_MIN
# define M_PI           3.14159265358979323846
#define   yeet    return 0;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long  b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

//typedef
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int mod = 1e9 +7 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}

inline int addMod(int a, int b, int m = mod) {return ((int64_t)a + b) % m;}
inline int mulMod(int a, int b, int m = mod) {  return ((int64_t)a * b) % m;}
inline int divMod(int a, int b, int m = mod) {int64_t x, y;int64_t g = extGcd(b, m, x, y);if (g != 1) {cerr << "Bad gcd!" << endl;for (;;);}x = (x % m + m) % m;return mulMod(a, x, m);}

inline ll exp(ll a,ll b){if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=r*(a%mod);r=(r+mod)%mod;}b/=2;a=(a%mod)*(a%mod);a=(a+mod)%mod;}return (r+mod)%mod;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }
// ll f[MAX];
// ll iv[MAX];
// ll C(ll n,ll r){
// 	 if(n<r)return 0;
// 	 ll ans=(f[n]%mod * iv[r]%mod)%mod;
// 	 ans=(ans%mod * iv[n-r]%mod)%mod;
// 	 return ans%mod;
// }
// void init(){
// 	 f[0]=1;
//      iv[0]=1;
//      f(i,1,MAX)f[i]=(i*f[i-1])%mod;
//      iv[MAX-1]=exp(f[MAX-1],mod-2);

//      for(int i=MAX-2;i>=0;--i)iv[i]=(iv[i+1]*(i+1))%mod;

// }

///* seive */  const int N= 10000000;int lp[N+1];vector<int> pr;void seive(){for (int i=2; i<=N; ++i) {if (lp[i] == 0) {lp[i] = i;pr.push_back (i);}for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j) lp[i * pr[j]] = pr[j]; }}
////****************************************************************************************************************************************************************************************************************////
 bool fourtimesImp(ll n,ll k,ll D1, ll D2){
             for(int sgn=-1;sgn<=1;sgn++){
             	 for(int sgn2=-1;sgn2<=1;sgn2++){
             	 	   if(sgn ==0  or sgn2==0 )continue;
             	 	   ll d1= sgn*D1;
             	 	   ll d2= sgn2*D2;
             	 	   ll x2;
             	 	   if( (k-d1+d2)%3 !=0)continue;
             	 	   else x2= (k-d1+d2)/3;
             	 	   if(x2>=0 and x2<=k){
             	 	   	ll x1=x2+d1;
             	 	   	ll x3=x2-d2;
             	 	   	if(x1>=0 and x1<=k and x3>=0 and x3<=k){
             	 	   		 if(x1<= n/3 and x2<= n/3 and x3 <= n/3){
                             assert(abs(x2-x1) ==d1);
                             assert(abs(x2-x3)==d2);
             	 	   		 	 return true;
             	 	   		 }
             	 	   	}

             	 	   }

             	 }
             }
             return false;
 }
 int main(){
 	   int t;
 	   cin>>t;
 	    while(t--){
 	    	  ll n,k,d1,d2;
 	    	  cin>>n>>k>>d1>>d2;
 	    	  if(n%3 !=0){cout<<"no"<<endl;continue;}
 	    	  bool ans=fourtimesImp(n,k,d1,d2);
 	    	  if(ans)cout<<"yes"<<endl;
 	    	  else cout<<"no"<<endl;
 	    }

 	return 0;
 }


#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>

const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define   endl    '\n'
#define   sl(n)     scanf("%lld",&n)
#define   mp      make_pair
#define   pb      push_back
#define   ppb     pop_back
#define   fi      first
#define   se      second
#define   ll      long long
#define   ull     unsigned long long
#define   ld      long double
#define   pii     pair<int, int>
#define   f(i,a,b)  for(ll i = (ll)(a); i < (ll)(b); i++)
#define   rf(i,a,b)   for(ll i = (ll)(a); i > (ll)(b); i--)
#define   ms(a,b)   memset((a),(b),sizeof(a))
#define   abs(x)    ((x<0)?(-(x)):(x))
#define   MAX     1000005
#define   inf     LLONG_MAX
#define   ninf    LLONG_MIN
#define   MIN     INT_MIN
# define M_PI           3.14159265358979323846
#define   yeet    return 0;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long  b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

//typedef
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int mod = 1e9 +7 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}

inline int addMod(int a, int b, int m = mod) {return ((int64_t)a + b) % m;}
inline int mulMod(int a, int b, int m = mod) {  return ((int64_t)a * b) % m;}
inline int divMod(int a, int b, int m = mod) {int64_t x, y;int64_t g = extGcd(b, m, x, y);if (g != 1) {cerr << "Bad gcd!" << endl;for (;;);}x = (x % m + m) % m;return mulMod(a, x, m);}

inline ll exp(ll a,ll b){if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=r*(a%mod);r=(r+mod)%mod;}b/=2;a=(a%mod)*(a%mod);a=(a+mod)%mod;}return (r+mod)%mod;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }
// ll f[MAX];
// ll iv[MAX];
// ll C(ll n,ll r){
// 	 if(n<r)return 0;
// 	 ll ans=(f[n]%mod * iv[r]%mod)%mod;
// 	 ans=(ans%mod * iv[n-r]%mod)%mod;
// 	 return ans%mod;
// }
// void init(){
// 	 f[0]=1;
//      iv[0]=1;
//      f(i,1,MAX)f[i]=(i*f[i-1])%mod;
//      iv[MAX-1]=exp(f[MAX-1],mod-2);

//      for(int i=MAX-2;i>=0;--i)iv[i]=(iv[i+1]*(i+1))%mod;

// }

///* seive */  const int N= 10000000;int lp[N+1];vector<int> pr;void seive(){for (int i=2; i<=N; ++i) {if (lp[i] == 0) {lp[i] = i;pr.push_back (i);}for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j) lp[i * pr[j]] = pr[j]; }}
////****************************************************************************************************************************************************************************************************************////
 bool fourtimesImp(ll n,ll k,ll D1, ll D2){
             for(int sgn=-1;sgn<=1;sgn++){
             	 for(int sgn2=-1;sgn2<=1;sgn2++){
             	 	   if(sgn ==0  or sgn2==0 )continue;
             	 	   ll d1= sgn*D1;
             	 	   ll d2= sgn2*D2;
             	 	   ll x2;
             	 	   if( (k-d1+d2)%3 !=0)continue;
             	 	   x2= (k-d1+d2)/3;
             	 	   if(x2>=0 and x2<=k){
             	 	   	ll x1=x2+d1;
             	 	   	ll x3=x2-d2;
             	 	   	if(x1>=0 and x1<=k and x3>=0 and x3<=k){
             	 	   		 if(x1<= n/3 and x2<= n/3 and x3 <= n/3){
                             assert(abs(x1-x2) ==d1);
                             assert(abs(x2-x3)==d2);
             	 	   		 	 return true;
             	 	   		 }
             	 	   	}

             	 	   }

             	 }
             }
             return false;
 }
 int main(){
 	   int t;
 	   cin>>t;
 	    while(t--){
 	    	  ll n,k,d1,d2;
 	    	  cin>>n>>k>>d1>>d2;
 	    	  if(n%3 !=0){cout<<"no"<<endl;continue;}
 	    	  bool ans=fourtimesImp(n,k,d1,d2);
 	    	  if(ans)cout<<"yes"<<endl;
 	    	  else cout<<"no"<<endl;
 	    }

 	return 0;
 }


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>

#define f first
#define S second
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>

using namespace std;

const int N = (int)2e5 + 3;
bool check(ll n, ll k, ll dt1, ll dt2)
{
	if(n % 3 != 0)
		return false;
	ll a, b, c;
	for(int i = -1; i <= 1; i += 2)
		for(int j = -1; j <= 1; j += 2)
		{
			ll d1 = dt1, d2 = dt2;
			d1 *= i; d2 *= j;
		//	cout <<  (k + 2 * d1 + d2) % 3 << endl;
			if((k + 2 * d1 + d2) % 3 != 0)
		    	continue;
		    a = (k + 2 * d1 + d2) / 3;
		    b = a - d1;
		    c = b - d2;
		   // k = min(n / 3, k);
		   // cout << a << ' ' << b << ' ' << c << endl;
		    if(a >= 0 && a <= k && b >= 0 && b <= k && c >= 0 && c <= k)
		    	if(a <= n / 3 && b <= n / 3 && c <= n / 3)
		    		return true;
		}
	 return false;
}

int main()
{
	ll ms, ns, ks, ds1, ds2;
	int m;
	cin >> m;
	for(int i = 0; i < m; i++)
	{
		scanf("%I64d %I64d %I64d %I64d", &ns, &ks, &ds1, &ds2);
		if(check(ns, ks, ds1, ds2))
			cout << "yes\n";
		else
			cout << "no\n";
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>

#define f first
#define S second
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>

using namespace std;

const int N = (int)2e5 + 3;
bool check(ll n, ll k, ll dt1, ll dt2)
{
	if(n % 3 != 0)
		return false;
	ll a, b, c;
	for(int i = -1; i <= 1; i += 2)
		for(int j = -1; j <= 1; j += 2)
		{
			ll d1 = dt1, d2 = dt2;
			d1 *= i; d2 *= j;
		//	cout <<  (k + 2 * d1 + d2) % 3 << endl;
			if((k + 2 * d1 + d2) % 3 != 0)
		    	continue;
		    a = (k + 2 * d1 + d2) / 3;
		    b = a - d1;
		    c = b - d2;
		    k = min(n / 3, k);
		   // cout << a << ' ' << b << ' ' << c << endl;
		    if(a >= 0 && a <= k && b >= 0 && b <= k && c >= 0 && c <= k)
		    	return true;
		}
	 return false;
}

int main()
{
	ll ms, ns, ks, ds1, ds2;
	int m;
	cin >> m;
	for(int i = 0; i < m; i++)
	{
		scanf("%I64d %I64d %I64d %I64d", &ns, &ks, &ds1, &ds2);
		if(check(ns, ks, ds1, ds2))
			cout << "yes\n";
		else
			cout << "no\n";
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>

#define f first
#define S second
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>

using namespace std;

const int N = (int)2e5 + 3;
bool check(ll n, ll k, ll d1, ll d2)
{
	if(n % 3)
		return false;
	ll a, b, c;
	for(int i = -1; i <= 1; i += 2)
		for(int j = -1; j <= 1; j += 2)
		{
			d1 *= i; d2 *= j;
			if((k + 2 * d1 + d2) % 3)
		    	continue;
		    a = (k + 2 * d1 + d2) / 3;
		    b = a - d1; c = b - d2;
		    k = min(n / 3, k);
		    if(a >= 0 && a <= k && b >= 0 && b <= k && c >= 0 && c <= k)
		    	return true;
		}
	 return false;
}

int main()
{
	ll ms, ns, ks, ds1, ds2;
	int m;
	cin >> m;
	for(int i = 0; i < m; i++)
	{
		scanf("%I64d %I64d %I64d %I64d", &ns, &ks, &ds1, &ds2);
		if(check(ns, ks, ds1, ds2))
			cout << "yes\n";
		else
			cout << "no\n";
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>

#define f first
#define S second
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int, int>

using namespace std;

const int N = (int)2e5 + 3;
bool check(ll n, ll k, ll dt1, ll dt2)
{
	if(n % 3 != 0)
		return false;
	ll a, b, c;
	for(int i = -1; i <= 1; i += 2)
		for(int j = -1; j <= 1; j += 2)
		{
			ll d1 = dt1, d2 = dt2;
			d1 *= i; d2 *= j;
		//	cout <<  (k + 2 * d1 + d2) % 3 << endl;
			if((k + 2 * d1 + d2) % 3 != 0)
		    	continue;
		    a = (k + 2 * d1 + d2) / 3;
		    b = a - d1;
		    c = b - d2;
		    k = min(n / 3, k);
		    cout << a << ' ' << b << ' ' << c << endl;
		    if(a >= 0 && a <= k && b >= 0 && b <= k && c >= 0 && c <= k)
		    	return true;
		}
	 return false;
}

int main()
{
	ll ms, ns, ks, ds1, ds2;
	int m;
	cin >> m;
	for(int i = 0; i < m; i++)
	{
		scanf("%I64d %I64d %I64d %I64d", &ns, &ks, &ds1, &ds2);
		if(check(ns, ks, ds1, ds2))
			cout << "yes\n";
		else
			cout << "no\n";
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define inf 1000000000
#define ii pair<int, int>
#define vi vector<int>
#define vii vector< vector<int> >
#define mod 1000000007
#define Left 1
#define Right 2

int main()
{
//    freopen("friday.in","r",stdin);
//    freopen("out.txt","w",stdout);
    int t;
    scanf("%d", &t);
    while(t--){
        ll n, k, d1, d2;
        scanf("%I64d%I64d%I64d%I64d", &n, &k, &d1, &d2);
//        cin>>n>>k>>d1>>d2;
        if(d1 < d2) swap(d1, d2);
        ll diff = n - k;
        diff -= d1 + d1 - d2;
        if(diff < 0 || diff % 3 != 0){
            printf("no\n");
        }else printf("yes\n");

    }

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define inf 1000000000
#define ii pair<int, int>
#define vi vector<int>
#define vii vector< vector<int> >
#define mod 1000000007
#define Left 1
#define Right 2

ll n, k;

bool solve(ll a, ll b, ll c)
{
    if((k - a - b - c) < 0 || (k - a - b - c) % 3) return false;
    if(a > b) swap(a, b);
    if(a > c) swap(a, c);
    if(b > c) swap(b, c);
    ll rem = n - k;
    rem = rem - (c - b + c - a);
    if(rem < 0 || rem % 3 != 0) return false;
    return true;

}

int main()
{
//    freopen("friday.in","r",stdin);
//    freopen("out.txt","w",stdout);
    int t;
    scanf("%d", &t);
    while(t--){
        ll d1, d2;
        scanf("%I64d%I64d%I64d%I64d", &n, &k, &d1, &d2);
        if(d1 < d2) swap(d1, d2);
//        cin>>n>>k>>d1>>d2;
        if(solve(d1, 0, d2) || solve(d1 + d2, d2, 0) || solve(0, d1, d1 - d2) || solve(0, d1, d1 + d2)) printf("yes\n");
        else printf("no\n");
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define inf 1000000000
#define ii pair<int, int>
#define vi vector<int>
#define vii vector< vector<int> >
#define mod 1000000007
#define Left 1
#define Right 2

ll n, k;

bool solve(ll a, ll b, ll c)
{
    if((k - a - b - c) < 0 || (k - a - b - c) % 3) return false;
    if(a > b) swap(a, b);
    if(a > c) swap(a, c);
    if(b > c) swap(b, c);
    ll rem = n - k;
    rem = rem - (c - b + c - a);
    if(rem < 0 || rem % 3 != 0) return false;
    return true;

}

int main()
{
//    freopen("friday.in","r",stdin);
//    freopen("out.txt","w",stdout);
    int t;
    scanf("%d", &t);
    while(t--){
        ll d1, d2;
        scanf("%I64d%I64d%I64d%I64d", &n, &k, &d1, &d2);
//        cin>>n>>k>>d1>>d2;
        if(solve(d1, 0, d2) || solve(d1 + d2, d2, 0) || solve(0, d1, d1 - d2) || solve(0, d1, d1 + d2)) printf("yes\n");
        else printf("no\n");
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define inf 1000000000
#define ii pair<int, int>
#define vi vector<int>
#define vii vector< vector<int> >
#define mod 1000000007
#define Left 1
#define Right 2

ll n, k;

bool solve(ll a, ll b, ll c)
{
    if(a > b) swap(a, b);
    if(a > c) swap(a, c);
    if(b > c) swap(b, c);
    ll rem = n - k;
    rem = rem - (c - b + c - a);
    if(rem < 0 || rem % 3 != 0) return false;
    return true;

}

int main()
{
//    freopen("friday.in","r",stdin);
//    freopen("out.txt","w",stdout);
    int t;
    scanf("%d", &t);
    while(t--){
        ll d1, d2;
        scanf("%I64d%I64d%I64d%I64d", &n, &k, &d1, &d2);
//        cin>>n>>k>>d1>>d2;
        if(solve(d1, 0, d2) || solve(d1, 0, -d2) || solve(0, d1, d1 - d2) || solve(0, d1, d1 + d2)) printf("yes\n");
        else printf("no\n");
    }
}


#include<bits/stdc++.h>
using namespace std;

#define si(n) scanf("%lld",&n)
#define ll long long

ll t,n,k,d1,d2;

bool f(ll x,ll y,ll z)
{
    if(min(x,min(y,z))<0){
        ll t=abs(min(x,min(y,z)));
        x+=t;y+=t;z+=t;
        if(x+y+z>z)return false;
    }
    if(x+y+z>k)return false;
    ll baki=n-k;
    ll mx=max(x,max(y,z));
    ll tot=(mx-x)+(mx-y)+(mx-z);
    if(tot>baki)return false;
    baki-=tot;
    if(baki%3==0)return true;
    return false;
}

int main()
{
    //freopen("input.txt","r",stdin);
    si(t);
    while(t--){
        si(n);si(k);si(d1);si(d2);

        if(f(0,d1,d1-d2)|| f(0,d1,d1+d2)
           || f(d1,0,-d2) || f(d1,0,d2))
            printf("yes\n");
        else printf("no\n");
    }
}


#include<bits/stdc++.h>
using namespace std;

#define si(n) scanf("%lld",&n)
#define ll long long

ll t,n,k,d1,d2;

bool f(ll x,ll y,ll z)
{
    if(min(x,min(y,z))<0){
        ll t=abs(min(x,min(y,z)));
        x+=t;y+=t;z+=t;
        if(x+y+z>k)return false;
    }
    if(x+y+z>k)return false;
    ll baki=n-k;
    ll mx=max(x,max(y,z));
    ll tot=(mx-x)+(mx-y)+(mx-z);
    if(tot>baki)return false;
    baki-=tot;
    if(baki%3==0)return true;
    return false;
}

int main()
{
    //freopen("input.txt","r",stdin);
    si(t);
    while(t--){
        si(n);si(k);si(d1);si(d2);

        if(f(0,d1,d1-d2)|| f(0,d1,d1+d2)
           || f(d1,0,-d2) || f(d1,0,d2))
            printf("yes\n");
        else printf("no\n");
    }
}


#include<bits/stdc++.h>
using namespace std;

#define si(n) scanf("%lld",&n)
#define ll long long

ll t,n,k,d1,d2;

bool f(ll x,ll y,ll z)
{
    if(min(x,min(y,z))<0){
        ll t=abs(min(x,min(y,z)));
        x+=t;y+=t;z+=t;
    }
    ll tt=k-x-y-z;
    if(tt<0)return false;
    if(tt%3)return false;
    ll baki=n-k;
    ll mx=max(x,max(y,z));
    ll tot=(mx-x)+(mx-y)+(mx-z);
    if(tot>baki)return false;
    baki-=tot;
    if(baki%3==0)return true;
    return false;
}

int main()
{
    //freopen("input.txt","r",stdin);
    si(t);
    while(t--){
        si(n);si(k);si(d1);si(d2);

        if(f(0,d1,d1-d2)|| f(0,d1,d1+d2)
           || f(d1,0,-d2) || f(d1,0,d2))
            printf("yes\n");
        else printf("no\n");
    }
}


#include<bits/stdc++.h>

using namespace std;

long long n,K,a,b;

bool Judge(long long x,long long y,long long z)
{
	if(x<0||y<0||z<0) return false;
	if(x+y+z>K) return false;
	if((x+y+z-K)%3!=0) return false;
	if(n/3<max(x,max(y,z))) return false;
	return true;
}

bool work()
{
	if(n%3!=0) return false;

	if(Judge(a+b,b,0)) return true;
	if(Judge(a,0,b)) return true;
	if(Judge(max(a,b)-a,max(a,b),max(a,b)-b)) return true;
	if(Judge(0,a,a+b)) return true;
	return false;
}

int main()
{
	int T;
	for(scanf("%d",&T);T;T--)
	{
		scanf("%I64d%I64d%I64d%I64d",&n,&K,&a,&b);
		if(work()) printf("yes\n");
		else printf("no\n");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 1.3e5;
int main()
{
	int T;
	scanf("%d", &T);
	while (T--)
	{
		long long n, k, d1, d2;
		scanf("%lld %lld %lld %lld", &n, &k, &d1, &d2);
		if (n % 3 || (k - d1 - d2) % 3)
		{
			puts("no");
			continue;
		}
		n /= 3;
		long long s1 = (k - d1 - d2) / 3;
		long long s2 = s1 + d1;
		long long s3 = s1 + d2;
		s1 = n - s1;
		s2 = n - s2;
		s3 = n - s3;
		if (s1 < 0 || s2 < 0 || s3 < 0)
			puts("no");
		else
			puts("yes");
		}
}


#include <cstdio>
#include <iostream>
#define LL long long

using namespace std ;

bool dose(LL n, LL k, LL d1,LL d2)
{
    for(int i = -1 ; i <= 1 ; i ++)
        for(int j = -1 ; j <= 1 ; j++)
        {
            if(i == 0 || j == 0)
                continue ;
            LL D1 = d1*i ,D2 = d2*j ;
            LL B = (k - D1 + D2) / 3 ;
            if((k - D1 + D2) % 3)  return false ;
            if(B >= 0 && B <= k)
            {
                LL A = D1+B,C = B-D2 ;
                if(A >= 0 && A <= k && C >= 0 && C <= k)
                    if(A <= n/3 && B <= n/3 && C <= n/3)
                        return true ;
            }
        }
    return false ;
}
int main()
{
    LL T,n,k,d1,d2 ;
    cin >> T;
    while(T--)
    {
        cin>>n >> k >> d1 >> d2 ;
        if(n % 3)
        {
            puts("no" );
            continue ;
        }
        bool flag = dose(n,k,d1,d2) ;
        if(flag) puts("yes") ;
        else puts("no") ;
    }
    return 0 ;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

long long n,k,d1,d2;

int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
	  scanf("%I64d%I64d%I64d%I64d",&n,&k,&d1,&d2);
	  if(n%3!=0){puts("no");continue;}
	  if(k>=max(d1,d2)+abs(d1-d2)&&n-k-d1-d2>=0&&(n-k-d1-d2)%3==0){puts("yes");continue;}
	  if(k>=d1+d2+d2&&n-k-d1-d2-d1>=0&&(n-k-d1-d2-d1)%3==0){puts("yes");continue;}
	  if(k>=d1+d2+d1&&n-k-d1-d2-d2>=0&&(n-k-d1-d2-d2)%3==0){puts("yes");continue;}
	  if(k>=d1+d2&&n-k-abs(d1-d2)-max(d1,d2)>=0&&(n-k-abs(d1-d2)-max(d1,d2))%3==0){puts("yes");continue;}
	  puts("no");
	}
	return 0;
}


#include <cstdio>
#include <iostream>
#define LL long long

using namespace std ;

bool dose(LL n, LL k, LL d1,LL d2)
{
    for(int i = -1 ; i <= 1 ; i ++)
        for(int j = -1 ; j <= 1 ; j++)
        {
            if(i == 0 || j == 0)
                continue ;
            LL D1 = d1*i ,D2 = d2*j ;
            LL B = (k - D1 + D2) / 3 ;
            if((k - D1 + D2) % 3)  continue;
            if(B >=1 && B <= k)
            {
                LL A = D1+B,C = B-D2 ;
                if(A >= 0 && A <= k && C >= 0 && C <= k)
                    if(A <= n/3 && B <= n/3 && C <= n/3)
                        return true ;
            }
        }
    return false ;
}
int main()
{
    LL T,n,k,d1,d2 ;
    cin >> T;
    while(T--)
    {
        cin>>n >> k >> d1 >> d2 ;
        if(n % 3)
        {
            puts("no" );
            continue ;
        }
        bool flag = dose(n,k,d1,d2) ;
        if(flag) puts("yes") ;
        else puts("no") ;
    }
    return 0 ;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<iomanip>
#include<stack>
#include<map>
#include<set>
#include<time.h>
#include<cmath>
#define debug(x) cerr<<#x<<"="<<x<<endl
#define INF 0x7f7f7f7f
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
inline int init()
{
    int now=0,ju=1;char c;bool flag=false;
    while(1)
    {
        c=getchar();
        if(c=='-')ju=-1;
        else if(c>='0'&&c<='9')
        {
            now=now*10+c-'0';
            flag=true;
        }
        else if(flag)return now*ju;
    }
}
inline long long llinit()
{
    long long now=0,ju=1;char c;bool flag=false;
    while(1)
    {
        c=getchar();
        if(c=='-')ju=-1;
        else if(c>='0'&&c<='9')
        {
            now=now*10+c-'0';
            flag=true;
        }
        else if(flag)return now*ju;
    }
}
ll n,k,x,y,t;
ll a,b,c;
ll minx;
int main()
{
	bool flag;
	t=llinit();
	ll tt;
	while(t--)
	{
		minx=INF;
		flag=false;
		n=llinit();k=llinit();x=llinit();y=llinit();
		c=(k-x-(2*y))/3;
		b=c+y;
		a=b+x;
		tt=n-k-2*x-y;
		if(a>=0&&b>=0&&c>=0&&a+b+c==k&&2*x+y<=n-k&&tt%3==0)
		{
			flag=true;
		}
		b=(k-x-y)/3;
		c=b+y;
		a=b+x;
		minx=min(x,y);
		tt=n-k-minx-2*abs(x-y);
		if(a>=0&&b>=0&&c>=0&&a+b+c==k&&minx+2*abs(x-y)<=n-k&&tt%3==0)
		{
			flag=true;
		}
		b=(k+x+y)/3;
		a=b-x;
		c=b-y;
		tt=n-k-x-y;
		if(a>=0&&b>=0&&c>=0&&a+b+c==k&&x+y<=n-k&&tt%3==0)
		{
			flag=true;
		}
		a=(k-2*x-y)/3;
		b=a+x;
		c=b+y;
		tt=n-k-x-2*y;
		if(a>=0&&b>=0&&c>=0&&a+b+c==k&&x+2*y<=n-k&&tt%3==0)
		{
			flag=true;
		}
		if(flag)printf("yes\n");
		else printf("no\n");
	}
	return 0;
}
/*
srO xudyh davidlee1999WTK linkct1999 zlser Orz
*/


//A + B + C = k ---(1)
//|A - B| = d1  ---(a)
//|B - C| = d2  ---(b)
#include<cstdio>
#include<iostream>

using namespace std;

#define LL long long
LL n,k,d1,d2,ave,x;

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        cin>>n>>k>>d1>>d2;
        if(n % 3)//如果n无法整除3，则无法达到三个平局
        {
            puts("no") ;
            continue ;
        }
        ave = n/3;
        bool flag = false ;
        //A>B&&B>C时，A-B=d1,B-C=d2
        //最小的是C，最大的是A
        //通过式子连立可求出C= (k-d1-2*d2)/3
        if( (k-d1-2*d2) % 3 == 0 && (k-d1-2*d2) >= 0)//C必须是整数并且大于等于0
        {
            x = (k-d1-2*d2)/3;
            if(x+d1+d2<=ave)//三者之中最大的是A，只要A小于等于平均值，BC都会满足
                flag = true;
        }
        //A>B&&B<C时，A-B=d1,B-C=-d2
        //最小的是B，AC无法辨大小
        //通过式子连立可求出B = （k-d1-d2）/3
        if( (k-d1-d2) % 3 == 0 && (k-d1-d2) >= 0)
        {
            x = (k-d1-d2)/3;
            if(x+d1<=ave&&x+d2<=ave)//AC比B大，只要判断AC是不是都小于平均数即可
                flag = true;
        }
        //A<B&&B<C时，A-B=-d1,B-C=-d2
        //最小的是A，C最大
        //通过式子连立可求出A = （k-2*d1-d2）/3
        if( (k-2*d1-d2) % 3 == 0 && (k-2*d1-d2) >= 0)
        {
            x = (k-2*d1-d2)/3;
            if(x+d1+d2 <= ave)
                flag = true;
        }
        //A<B&&B>C时，A-B=-d1,B-C=d2
        //最大的是B，AC无法辨大小
        //通过式子连立可求出A = （k-2*d1+d2）/3,C=(k+d1-2*d2)
        if( (k+d2-2*d1)%3==0 && (k+d2-2*d1)>=0 && (k+d1-2*d2)%3==0 && (k+d1-2*d2)>=0)
        {
            x = (k+d2-2*d1)/3;
            if(x+d1 <= ave)
                flag = true;
        }
        if(flag) puts("yes");
        else puts("no");
    }
    return 0;
}


#include<cstdio>
#include<cstring>
long long t,n,k,d1,d2,s1,s;

int main()
{
	scanf("%I64d",&t);
	while(t--)
	{
		scanf("%I64d%I64d%I64d%I64d",&n,&k,&d1,&d2);
		s1=d1+d2;
		s=s1+d2;
		if(n%3!=0||s>n||s>(n/3)||d2>(n/3)) {printf("no\n");continue;}
		else printf("yes\n");
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cassert>

using namespace std;

bool valid(long long b,long long c,long long n){
    long long max_num = max(b,c);
    long long to_add = max_num + max_num-min(b,c);

    if(n<to_add)return false;
    else if((n-to_add)%3==0){
        return true;
    }else{
        long long remained = max_num - n-to_add;
        long long n_remained = max_num%2;
        long long n_max = max_num + n_remained/2;
        if(n_max>=n_remained+min(b,c)){
            cout << "yes" << endl;
        } else{
            cout << "no" << endl;
        }
    }
}

void process_single_case() {
    //valid(3,3,3);

    long long n, k, d1, d2;
    cin >> n >> k >> d1 >> d2;
    bool con1 = d1+d1+d2<=k      && k-(d1+d1+d2)%3==0   &&valid(d1,d1+d2,n-k);
    bool con2 = d1+d2+d2<=k      && k-(d1+d2+d2)%3==0   &&valid(d2,d1+d2,n-k);
    bool con3 = d1+max(d1,d2)<=k && d1+max(d1,d2)-k%3==0&&valid(d1,max(d1,d2),n-k);
    bool con4 = d2+max(d1,d2)<=k && d2+max(d1,d2)-k%3==0&&valid(d2,max(d1,d2),n-k);

    cout << (con1||con2||con3||con4 ? "yes":"no") << endl;
}

int main()
{
    int N;
    cin >> N;
    while(N-->0)process_single_case();
}


#include <iostream>
#include <algorithm>
#include <cassert>

using namespace std;

bool valid(long long b,long long c,long long n){
    return true;
    long long max_num = max(b,c);
    long long to_add = max_num + max_num-min(b,c);

    if(n<to_add)return false;
    else if((n-to_add)%3==0){
        return true;
    }else{
        long long remained = max_num - n-to_add;
        long long n_remained = remained%2;
        long long n_max = max_num + remained/2;
        if(n_max>=n_remained+min(b,c)){
            return true;
        } else{
            return false;
        }
    }
}

void process_single_case() {
    //valid(3,3,3);

    long long n, k, d1, d2;
    cin >> n >> k >> d1 >> d2;
    bool con1 = d1+d1+d2<=k      && k-(d1+d1+d2)%3==0   &&valid(d1,d1+d2,n-k);
    bool con2 = d1+d2+d2<=k      && k-(d1+d2+d2)%3==0   &&valid(d2,d1+d2,n-k);
    bool con3 = d1+max(d1,d2)<=k && d1+max(d1,d2)-k%3==0&&valid(d1,max(d1,d2),n-k);
    bool con4 = d2+max(d1,d2)<=k && d2+max(d1,d2)-k%3==0&&valid(d2,max(d1,d2),n-k);

    cout << (con1||con2||con3||con4 ? "yes":"no") << endl;
}

int main()
{
    int N;
    cin >> N;
    while(N-->0)process_single_case();
}


//*
#include <algorithm>
#include <ctype.h>
#include <functional>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <vector>

#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <char, char> pcc;
typedef pair <int, char> pic;
typedef pair <int, ll> pil;
typedef pair <ll, int> pli;

const int IT_MAX = 131072;
const ll MOD = 1000000007;
const int INF = 2034567891;
const ll LL_INF = 1234567890123456789ll;

int main() {
    int T;
    scanf("%d", &T);
    for (int tc = 1; tc <= T; tc++) {
        ll N, K, d1, d2;
        scanf("%I64d %I64d %I64d %I64d", &N, &K, &d1, &d2);
        if (N % 3 != 0) {
            printf("no");
            continue;
        }
        if (max(d1, d2) * 3 - d1 - d2 <= N - K && max(d1, d2)*3 <= N) printf("yes\n");
        else if (d1 + d2 <= N - K && max(d1, d2) * 3 <= N) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}
//*/


//*
#include <algorithm>
#include <ctype.h>
#include <functional>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <vector>

#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <char, char> pcc;
typedef pair <int, char> pic;
typedef pair <int, ll> pil;
typedef pair <ll, int> pli;

const int IT_MAX = 131072;
const ll MOD = 1000000007;
const int INF = 2034567891;
const ll LL_INF = 1234567890123456789ll;

int main() {
    int T;
    scanf("%d", &T);
    for (int tc = 1; tc <= T; tc++) {
        ll N, K, d1, d2;
        scanf("%I64d %I64d %I64d %I64d", &N, &K, &d1, &d2);
        if (N % 3 != 0) {
            printf("no");
            continue;
        }
        if (max(d1, d2) * 3 - d1 - d2 <= N - K && max(d1, d2)*3 <= N && d1+d2 <= K) printf("yes\n");
        else if (d1 + d2 <= N - K && max(d1, d2) * 3 <= N) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}
//*/


//*
#include <algorithm>
#include <ctype.h>
#include <functional>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <vector>

#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <char, char> pcc;
typedef pair <int, char> pic;
typedef pair <int, ll> pil;
typedef pair <ll, int> pli;

const int IT_MAX = 131072;
const ll MOD = 1000000007;
const int INF = 2034567891;
const ll LL_INF = 1234567890123456789ll;

int main() {
    int T;
    scanf("%d", &T);
    for (int tc = 1; tc <= T; tc++) {
        ll N, K, d1, d2, i, j;
        scanf("%I64d %I64d %I64d %I64d", &N, &K, &d1, &d2);
        if (N % 3 != 0) {
            printf("no\n");
            return 0;
        }
        for (i = -1; i <= 1; i += 2) {
            for (j = -1; j <= 1; j += 2) {
                ll t1 = d1*i, t2 = d2*i;
                ll x1, x2, x3;
                if ((K - t1 - 2 * t2) % 3 != 0 || (K - t1 - 2 * t2) < 0) continue;
                x3 = (K - t1 - 2 * t2) / 3;
                x2 = x3 + t2;
                x1 = x2 + t1;
                if (max(max(x1, x2), x3) <= N / 3 && min(min(x1, x2), x3) >= 0) break;
            }
            if (j <= 1) break;
        }
        if (i <= 1) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}
//*/


//*
#include <algorithm>
#include <ctype.h>
#include <functional>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <vector>

#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <char, char> pcc;
typedef pair <int, char> pic;
typedef pair <int, ll> pil;
typedef pair <ll, int> pli;

const int IT_MAX = 131072;
const ll MOD = 1000000007;
const int INF = 2034567891;
const ll LL_INF = 1234567890123456789ll;

int main() {
    int T;
    scanf("%d", &T);
    for (int tc = 1; tc <= T; tc++) {
        ll N, K, d1, d2;
        scanf("%I64d %I64d %I64d %I64d", &N, &K, &d1, &d2);
        if (max(d1, d2) * 3 - d1 - d2 <= N - K || d1+d2 <= N-K) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}
//*/


//*
#include <algorithm>
#include <ctype.h>
#include <functional>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <vector>

#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <char, char> pcc;
typedef pair <int, char> pic;
typedef pair <int, ll> pil;
typedef pair <ll, int> pli;

const int IT_MAX = 131072;
const ll MOD = 1000000007;
const int INF = 2034567891;
const ll LL_INF = 1234567890123456789ll;

int main() {
    int T;
    scanf("%d", &T);
    for (int tc = 1; tc <= T; tc++) {
        ll N, K, d1, d2, i, j;
        scanf("%I64d %I64d %I64d %I64d", &N, &K, &d1, &d2);
        if (N % 3 != 0) {
            printf("no\n");
            continue;
        }
        for (i = -1; i <= 1; i += 2) {
            for (j = -1; j <= 1; j += 2) {
                ll t1 = d1*i, t2 = d2*j;
                ll x1, x2, x3;
                if ((K - t1 - 2 * t2) % 3 != 0 || (K - t1 - 2 * t2) < 0) continue;
                x3 = (K - t1 - 2 * t2) / 3;
                x2 = x3 + t2;
                x1 = x2 + t1;
                if (max(max(x1, x2), x3) <= N / 3 && min(min(x1, x2), x3) >= 0) break;
            }
            if (j <= 1) break;
        }
        if (i <= 1) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}
//*/


//*
#include <algorithm>
#include <ctype.h>
#include <functional>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <vector>

#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <char, char> pcc;
typedef pair <int, char> pic;
typedef pair <int, ll> pil;
typedef pair <ll, int> pli;

const int IT_MAX = 131072;
const ll MOD = 1000000007;
const int INF = 2034567891;
const ll LL_INF = 1234567890123456789ll;

int main() {
    int T;
    scanf("%d", &T);
    for (int tc = 1; tc <= T; tc++) {
        ll N, K, d1, d2;
        scanf("%I64d %I64d %I64d %I64d", &N, &K, &d1, &d2);
        if (max(d1, d2) * 3 - d1 - d2 <= N - K) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}
//*/


//*
#include <algorithm>
#include <ctype.h>
#include <functional>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <vector>

#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <char, char> pcc;
typedef pair <int, char> pic;
typedef pair <int, ll> pil;
typedef pair <ll, int> pli;

const int IT_MAX = 131072;
const ll MOD = 1000000007;
const int INF = 2034567891;
const ll LL_INF = 1234567890123456789ll;

int main() {
    int T;
    scanf("%d", &T);
    for (int tc = 1; tc <= T; tc++) {
        ll N, K, d1, d2, i, j;
        scanf("%I64d %I64d %I64d %I64d", &N, &K, &d1, &d2);
        if (N % 3 != 0) {
            printf("no\n");
            continue;
        }
        for (i = -1; i <= 1; i += 2) {
            for (j = -1; j <= 1; j += 2) {
                ll t1 = d1*i, t2 = d2*i;
                ll x1, x2, x3;
                if ((K - t1 - 2 * t2) % 3 != 0 || (K - t1 - 2 * t2) < 0) continue;
                x3 = (K - t1 - 2 * t2) / 3;
                x2 = x3 + t2;
                x1 = x2 + t1;
                if (max(max(x1, x2), x3) <= N / 3 && min(min(x1, x2), x3) >= 0) break;
            }
            if (j <= 1) break;
        }
        if (i <= 1) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}
//*/