#include int main(void){ int a, b, c; int a1, b2, c3; scanf("%d.%d.%d", &a, &b, &c); scanf("%d.%d.%d", &a1, &b2, &c3); if(a > a1){ printf("YES\n"); }else if(a == a1 && b > b2){ printf("YES\n"); }else if(a == a1 && b == b2 && c >= c3){ printf("YES\n"); }else{ printf("NO\n"); } return 0; }