package P138; import java.io.*; import java.util.Arrays; import java.util.Scanner; public class P138 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String l = sc.next(); String[] lstrs = l.split("\\.",0); String n = sc.next(); String[] nstrs = n.split("\\.",0); int lint[] = new int[10]; int nint[] = new int[10]; for (int i=0;i<3;i++) { lint[i] = Integer.parseInt(lstrs[i]); nint[i] = Integer.parseInt(nstrs[i]); } if (lint[0] > nint[0]) { System.out.println("YES"); } else if (lint[0] < nint[0]) { System.out.println("NO"); } else { if(lint[1] > nint[1]) { System.out.println("YES"); } else if (lint[1] < nint[1]) { System.out.println("NO"); } else { if(lint[2] >= nint[2]) { System.out.println("YES"); } else { System.out.println("NO"); } } } } }