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