import java.util.Scanner; public class No779 { 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 hantei = 0; // 1 = × if( Y <= 1990 && Y >= 2020 ){ hantei = 1; } if( Y == 2019 && M >= 5 ){ hantei = 1; } if( Y == 1989 && D <= 7 ){ hantei = 1; } if( Y == 2019 && M >= 5 ){ hantei = 1; } if( hantei == 1 ){ System.out.println( "NO" ); } else{ System.out.println( "YES" ); } } }