import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main_yukicoder138 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] abc = {sc.next(), sc.next()}; int[][] v = new int[2][3]; String regex = "(\\d+)\\.(\\d+)\\.(\\d+)"; Pattern p = Pattern.compile(regex); for (int i = 0; i < 2; i++) { Matcher m = p.matcher(abc[i]); if (m.find()) { v[i][0] = Integer.parseInt(m.group(1)); v[i][1] = Integer.parseInt(m.group(2)); v[i][2] = Integer.parseInt(m.group(3)); } } boolean flag; if (v[0][0] < v[1][0]) { flag = false; } else if (v[0][0] > v[1][0]) { flag = true; } else { if (v[0][1] < v[1][1]) { flag = false; } else if (v[0][1] > v[1][1]) { flag = true; } else { if (v[0][2] < v[1][2]) { flag = false; } else if (v[0][2] > v[1][2]) { flag = true; } else { flag = true; } } } if (flag) { System.out.println("YES"); } else { System.out.println("NO"); } sc.close(); } }