a,b,c,d,e;main(f){scanf("%d.%d.%d%d.%d.%d",&a,&b,&c,&d,&e,&f);a=!printf(d>a||d==a&&e>b||d==a&&e==b&&f>c?"NO":"YES");}