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 = "YES"; for(int i = 0; i < 3; i++) { int k = Integer.parseInt(v1[i]); int t = Integer.parseInt(v2[i]); if(k < t) { ans = "NO"; break; } } System.out.println(ans); } }