import java.util.*; class Yukico138 { public static void main(String[] args) { Scanner stdio = new Scanner(System.in); String s0 = stdio.next(); String s1 = stdio.next(); String[] ver0 = new String[3]; String[] ver1 = new String[3]; ver0 = s0.split("[.]"); ver1 = s1.split("[.]"); boolean yes = true; for(int i=0; i<3; i++) { if(Integer.parseInt(ver0[i]) < Integer.parseInt(ver1[i])) { yes = false; break; } } if(yes) { System.out.println("YES"); } else { System.out.println("NO"); } } }