#include using namespace std; int main() {int n,x,y,z,t; int a; cin>>n; while(n) {cin>>x>>y>>z>>t; a=x*1000+y*100+z*10+t; if((x==2 && y>3) || (x>2) || (z>6) || (x<0 || y<0 || z<0 || t<0)) cout<<"NO\n"; else if((x==z && y==t) || (x==t && y==z) ) cout<<"YES\n"; else if((z==0 && t==0) || ((t==z+1 && z==y+1 && y==x+1))) cout<<"YES\n"; else if((a==1024) || (a==2048) ) cout<<"YES\n"; else cout<<"NO\n"; n--; } return 0; }