import java.util.Scanner; class No_138 { public static void main(String args[]) { Scanner stdIn = new Scanner(System.in); String[] old_ver = stdIn.next().split("\\."); String[] ver = stdIn.next().split("\\."); for (int i = 0; i < 3; i++) { if (Integer.parseInt(ver[i]) > Integer.parseInt(old_ver[i])) { System.out.println("NO"); System.exit(0); } } System.out.println("YES"); } }