import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; import java.util.TreeSet; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final String[] olds = sc.next().split("\\."); final String[] curs = sc.next().split("\\."); boolean old = true; for(int i = 0; i < 3; i++){ final int old_ver = Integer.parseInt(olds[i]); final int cur_ver = Integer.parseInt(curs[i]); if(old_ver < cur_ver){ old = false; break; }else if(old_ver > cur_ver){ old = true; break; } } System.out.println(old ? "YES" : "NO"); } }