import java.io.*; import java.util.*; import java.util.stream.*; // 処理 class Process { private int[] A; private int[] B; private int[] C; Process(int[] A, int[] B, int[] C) { this.A = A; this.B = B; this.C = C; } String getResult() { if(A[1] < A[0]) { return "YES"; } if(A[1] > A[0]) { return "NO"; } // 以下、 A が同じ if(B[1] < B[0]) { return "YES"; } if(B[1] > B[0]) { return "NO"; } // 以下、 B が同じ if(C[1] < C[0]) { return "YES"; } if(C[1] > C[0]) { return "NO"; } // 同じバージョン return "YES"; } } public class Main { public static void main(String[] args) throws IOException { var bufferedReader = new BufferedReader(new InputStreamReader(System.in)); var printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); // 入力 var A = new int[2]; var B = new int[2]; var C = new int[2]; for(int i = 0; i < 2; i++) { int[] input = Stream.of(bufferedReader.readLine().trim().split("\\.")).mapToInt(Integer::parseInt).toArray(); A[i] = input[0]; B[i] = input[1]; C[i] = input[2]; } // 出力 printWriter.println((new Process(A, B, C)).getResult()); bufferedReader.close(); printWriter.close(); } }