class Version { int[] num = new int[3]; static boolean checkVersion(int[] num1, int[] num2, int i) { if (i > 2 || num1[i] > num2[i]) { return true; } else if (num1[i] < num2[i]) { return false; } else { return checkVersion(num1, num2, ++i); } } } public class No_138 { public static void main(String[] args) { java.util.Scanner sc = new java.util.Scanner(System.in); String[] s1 = sc.nextLine().split("\\."); String[] s2 = sc.nextLine().split("\\."); Version old = new Version(); Version set = new Version(); for (int i = 0; i < 3; i++) { old.num[i] = Integer.parseInt(s1[i]); set.num[i] = Integer.parseInt(s2[i]); } if (Version.checkVersion(old.num, set.num, 0)) { System.out.println("YES"); } else { System.out.println("NO"); } } }