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