CSES - Shared codeLink to this code: https://cses.fi/paste/9f23a1a9c36cb63a18af51/
#include<bits/stdc++.h>
#define ll long long
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

int main(){
	fio;
	int t=1;
	cin>>t;
	while(t--){
		int a,b; cin>>a>>b; 
		if(a>=b){
			int k=abs(a-b);
			a-=2*k; b-=k;
			if(a==b && a>=0  && a%3==0) cout<<"YES\n";
			else cout<<"NO\n";
		}
		else{
			int k=abs(a-b);
			b-=2*k; a-=k;
			if(a==b && a>=0 && a%3==0) cout<<"YES\n";
			else cout<<"NO\n";
		}
	}

	return 0;
}