#include #include using namespace std; //ifstream in("pec.in"); //ofstream out("pec.out"); int main() { int n; cin>>n; for(int k=1;k<=n;k++) { int x; int y; int z; int t; char douapuncte; cin>>x>>douapuncte>>z; y=x%10; t=z%10; x/=10; z/=10; if(z==0 && t==0) cout<<"YES"; else if(x==z && y==t) cout<<"YES"; else if(y==t && z==x) cout<<"YES"; else if(x+1==y && y+1==z && z+1==t) cout<<"YES"; else if(1000*x+100*y+10*z+t==1024 || 1000*x+100*y+10*z+t==2048) cout<<"YES"; else cout<<"NO"; cout<<"\n"; } return 0; }