import java.util.*; public class Run { public static void main (String arg[]) { Scanner scan = new Scanner(System.in); scan.useDelimiter("[^0-9]"); int A = scan.nextInt(); int B = scan.nextInt(); int C = scan.nextInt(); int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt(); boolean flag = false; if (a > A) flag = true; else if (a==A && b>B) flag = true; else if (a==A && b==B && c > C) flag = true; String ans; if (flag) ans = "NO"; else ans = "YES"; System.out.println(ans); } }