import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.stream.Stream; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String[] S = reader.readLine().split("\\."); String[] M = reader.readLine().split("\\."); int[] possibleOldVersion = Stream.of(S).mapToInt(Integer::parseInt).toArray(); int[] targetVersion = Stream.of(M).mapToInt(Integer::parseInt).toArray(); for (int i = 0; i < 3; i++) { if (possibleOldVersion[i] < targetVersion[i]) { System.out.println("NO"); break; } else if (possibleOldVersion[i] == targetVersion[i]) { if (i==2) { System.out.println("YES"); } } else { System.out.println("YES"); break; } } } }