#include <stdio.h>

int main() {
    int a, b,c,d,e,f,g;
    while (scanf("%d %d %d\n%d %d %d", &a, &b,&c,&e,&f,&g) != EOF) { // 注意 while 处理多个 case
        // 64 位输出请用 printf("%lld") to 
        int date =a*365+b*30+c;
        int now = e*365+f*30+g;
        if(now>=date)
        {
            printf("yes\n");
        }
        else {
            printf("no\n");
        }
    }
    return 0;
}