import java.math.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String aString = sc.next(); String bString=sc.next(); if((int)aString.charAt(0) < (int)bString.charAt(0) ){ System.out.println("NO"); return; } if((int)aString.charAt(2) < (int)bString.charAt(2) ){ System.out.println("NO"); return; } if((int)aString.charAt(4) < (int)bString.charAt(4) ){ System.out.println("NO"); return; } System.out.println("YES"); } }