i,f;main(a,b){scanf("%d.",&f);f=i++%3?main(a*200+f,b):i-7?main(f,a):!puts(a>b?"NO":"YES");}