import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No138 { public static void main(String[] args) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] str1 = br.readLine().split("\\."); int[] ver1 = new int[3]; dainyu(ver1, str1); String[] str2 = br.readLine().split("\\."); int[] ver2 = new int[3]; dainyu(ver2, str2); Hantei(ver1[0], ver2[0]); Hantei(ver1[1], ver2[1]); Hantei(ver1[2], ver2[2]); System.out.println("YES"); }catch(IOException e){ e.getStackTrace(); }catch(NumberFormatException e){ e.getStackTrace(); } } public static void dainyu(int[] x, String[] y){ for(int i=0; i < y.length; i++) x[i] = Integer.parseInt(y[i]); } public static void Hantei(int a, int b){ if(a>b){ System.out.println("YES"); System.exit(0); } else if(a