import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//计划的时间
String str1y = scan.next();
String str1m = scan.next();
String str1d = scan.next();
//询问时间
String str2y = scan.next();
String str2m = scan.next();
String str2d = scan.next();
int y1 = Integer.parseInt(str1y);
int m1 = Integer.parseInt(str1m);
int d1 = Integer.parseInt(str1d);
int y2 = Integer.parseInt(str2y);
int m2 = Integer.parseInt(str2m);
int d2 = Integer.parseInt(str2d);
if(y1 < y2) {
System.out.println("yes");
} else if(y1 == y2 && m1 < m2) {
System.out.println("yes");
} else if(y1 == y2 && m1 == m2 && d1 <= d2) {
System.out.println("yes");
} else {
System.out.println("no");
}
}
}