Monety

#include<bits/stdc++.h>
using namespace std; 
#define int int64_t
#define pb push_back
#define f(a,b) 
for(int i=a; i<b; i++) 
signed main(){    
  int t; cin>>t;    
  int a, b;    
  while(t--)    
  {        
    cin>>a>>b;        
    while(true)        
    {            
      a>b ? a-=2, b-- : b -= 2,a--;            
      if(a==0 || b==0) break;        
    }        
    if(a==0 && b==0) { cout<<"YES\n"; continue; }        
    if(a==0 && b!=0) { cout<<"NO\n"; continue; }        
    if(a!=0 || b==0) { cout<<"NO\n"; continue; }    
  }    
  return 0;
}
Thoughtful Toad