import java.util.Scanner; public class P138 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String l = sc.next(); String[] lstrs = l.split("\\.",0); String n = sc.next(); String[] nstrs = n.split("\\.",0); int lint[] = new int[10]; int nint[] = new int[10]; for (int i=0;i<3;i++) { lint[i] = Integer.parseInt(lstrs[i]); nint[i] = Integer.parseInt(nstrs[i]); } if (lint[0] >= nint[0]) { if(lint[1] >= nint[1]) { if(lint[2] > nint[2]) { System.out.println("YES"); } else { System.out.println("NO1"); } } else { System.out.println("NO2"); } } else { System.out.println("NO3"); } } }