#include using namespace std; int x,y,z,t; int validare(int a, int b) { if(a>=552 || b>=588) return 0; if(b==528) return 1; else if(a==b) return 1; else if(a==t*10+z) return 1; else if(x+1==y && x+2==z && x+3==t) return 1; else if(x==0) return 0; else if(x!=48) { if(a+b==1090 || a+b==1124) return 1; } return 0; } int main() { int n,a=0,b=0; char s[6]; cin>>n; for(int i=0;i>s; x=s[0]; y=s[1]; z=s[3]; t=s[4]; a=x*10+y; b=z*10+t; if(validare(a,b)==1) cout<<"YES"<