import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int y=sc.nextInt();
        int m=sc.nextInt();
        int d=sc.nextInt();
        int y1=sc.nextInt();
        int m1=sc.nextInt();
        int d1=sc.nextInt();
        if(y<y1)
        {
            System.out.println("yes");
        }else if(y==y1)
        {
            if(m<m1)
            {
                System.out.println("yes");
            }else if(m==m1){
                if(d<=d1)
                {
                    System.out.println("yes");
                }else {
                    System.out.println("no");
               }
            }else{
                System.out.print("no");
            }
        }else{
            System.out.print("no");
        }
    }
}