import java.util.*; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String[] v1 = in.next().split("\\."); String[] v2 = in.next().split("\\."); String ans = "NO"; if(compare(v1, v2) >= 0) ans = "YES"; System.out.println(ans); } public static int compare(String[] a, String[] b) { for(int i = 0; i < 3; i++) { int k = Integer.parseInt(a[i]); int t = Integer.parseInt(b[i]); if(k != t) return k - t; } return 0; } }