package m.shin; import java.util.Scanner; public class Con138 { public static void main(String[] args) { Scanner s = new Scanner(System.in); String[] verA = s.next().split("\\.",3); String[] verB = s.next().split("\\.",3); s.close(); int[] A = new int[3] ,B = new int[3]; for(int i = 0;i < 3;i++){ A[i] = Integer.parseInt(verA[i]); B[i] = Integer.parseInt(verB[i]); } if(A[0] > B[0]){ System.out.println("YES"); }else if(A[0] == B[0]){ if(A[1] > B[1]){ System.out.println("YES"); }else if(A[1] == B[1]){ if(A[2] >= B[2]){ System.out.println("YES"); }else{ System.out.println("NO"); } }else{ System.out.println("NO"); } }else{ System.out.println("NO"); } } }