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++){ if(s0[i].compareTo(s1[i])<0){ System.out.println("NO"); break; } else if(s0[i].compareTo(s1[i])>0){ System.out.println("YES"); break; } } } } }