package b2015_5_31; import java.util.Scanner; public class KasekiVer3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.nextLine(); String s2 = sc.nextLine(); sc.close(); String a = ""; String b = ""; int ca1 = 1; int ca2 = Nuki(s1, a, ca1).length() + 2; int cb1 = 1; int cb2 = Nuki(s2, b, cb1).length() + 2; int Voa = Integer.parseInt(Nuki(s1, a, ca1)); int Vob = Integer.parseInt(Nuki(s2, b, cb1)); int n = 0; for(int i = 0; i<4; i++){ if(Voa >Vob){ System.out.println("YES"); break; }else if(Voa < Vob){ System.out.println("NO"); break; }else if(Voa==Vob){ a = ""; b = ""; Voa = 0; Vob = 0; if(n==0){ Voa = Integer.parseInt(Nuki(s1, a, ca2)); Vob = Integer.parseInt(Nuki(s2, b, cb2)); }else if(n==1){ int ca3 = ca2 + 2; int cb3 = cb2 + 2; Voa = Integer.parseInt(Nuki(s1, a, ca3)); Vob = Integer.parseInt(Nuki(s2, b, cb3)); if(Voa >Vob){ System.out.println("YES"); break; }else if(Voa < Vob){ System.out.println("NO"); break; }else if(Voa==Vob){ System.out.println("YES"); break; } } n++; } } } public static String Nuki(String s, String ab, int c){ int t; while(!(s.substring(c-1, c)).equals(".")){ ab+=s.substring(c-1, c); if(c==s.length()){ break; }else if(c