import java.util.*; public class Main { private final static Main main = new Main(); public static void main(String[] args) { long l = System.currentTimeMillis(); main.answer(); //System.err.println("経過時間:"+(System.currentTimeMillis() - l)); } private void answer() { Scanner sc = new Scanner(System.in); String[] as = sc.nextLine().split("\\."); int a = Integer.valueOf(as[0])*100 + Integer.valueOf(as[1])*10 + Integer.valueOf(as[2]); String[] bs = sc.nextLine().split("\\."); int b = Integer.valueOf(bs[0])*100 + Integer.valueOf(bs[1])*10 + Integer.valueOf(bs[2]); sc.close(); System.out.println(a>b?"YES":"NO"); } }