#include int main(void) { int a[100]; int b[100]; int c[100]; int i; int a1; int a2; int a3; char c1[2]; for(i=0;i<2;i++){ scanf("%d%c%d%c%d",&a[i],&c1[i],&b[i],&c[i],&c[i]); } if(a[0]>a[1]){ printf("YES\n"); }else if(a[0]==a[1]&&b[0]>b[1]){ printf("YES\n"); }else if(a[0]==a[1]&&b[0]==b[1]&&(c[0]>c[1]||c[0]==c[1])){ printf("YES\n"); }else{ printf("NO\n"); } return 0; }