import java.io.BufferedReader; import java.io.InputStreamReader; public class No138 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader( System.in)); int[] fossilVer = strToIntArray(br.readLine()); int[] currentVer = strToIntArray(br.readLine()); String str = "NO"; if (fossilVer[0] > currentVer[0]) { str = "YES"; } else if (fossilVer[0] == currentVer[0]) { if (fossilVer[1] > currentVer[1]) { str = "YES"; } else if (fossilVer[1] == currentVer[1]) { if (fossilVer[2] >= currentVer[2]) { str = "YES"; } } } System.out.println(str); } catch (Exception e) { System.err.println("Error:" + e.getMessage()); } } static int[] strToIntArray(String S) { String[] strArray = S.split("\\."); int[] intArray = new int[strArray.length]; for (int i = 0; i < strArray.length; i++) { intArray[i] = Integer.parseInt(strArray[i]); } return intArray; } }