import java.io.*; import java.util.Scanner; class Test{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String str1 = sc.next(), str2 = sc.next(); String[] a = str1.split("\\."); String[] b = str2.split("\\."); for(int i=0; i<3; i++){ int tmp1=Integer.parseInt(a[i]), tmp2 = Integer.parseInt(b[i]); if(tmp1 > tmp2){ System.out.println("YES"); return; } if(tmp1 < tmp2){ System.out.println("NO"); return; } } System.out.println("YES"); } }