import java.util.*; public class Kaseki { public static void main(String[] arg){ Scanner sc = new Scanner(System.in); int flag=0; String in; String[] a = sc.next().split("\\."); String[] b = sc.next().split("\\."); for(int i = 0;i<3;i++){ if(Integer.parseInt(a[i])< Integer.parseInt(b[i])){ flag=1; break; }else if(Integer.parseInt(a[i])== Integer.parseInt(b[i])){ continue; }else{ flag = 0; break; } } if(flag == 0){ System.out.println("YES"); }else{ System.out.println("NO"); } } }