import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a0 = sc.next(); String a1 = sc.next(); String[] s1 = a0.split("\\."); String[] s2 = a1.split("\\."); String ans = ""; for(int i = 0 ; i < s1.length ; i++) { if(s1[i].compareTo(s2[i]) > 0) { ans = "YES"; break; } else if(s1[i].compareTo(s2[i]) < 0){ ans = "NO"; break; } else if(s1[i].compareTo(s2[i]) == 0 && i == 2) { ans = "YES"; } } System.out.println(ans); } }