import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNext()){ String[] s0=(sc.next()).split("\\."); String[] s1=(sc.next()).split("\\."); for(int i=0;i<3;i++){ int a=Integer.parseInt(s0[i]); int b=Integer.parseInt(s1[i]); if(a>b){ System.out.println("YES"); break; } else if(b>a){ System.out.println("NO"); break; } if(i==2) System.out.println("YES"); } } } }