import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.next(); String s2 = sc.next(); String[] s1d = s1.split("."); String[] s2d = s2.split("."); String ans = "NO"; for(int i = 0; i < 3; i++) { int a = Integer.parseInt(s1d[i]); int b = Integer.parseInt(s2d[i]); if(a > b) { ans = "YES"; break; } if(i == 2) ans = "YES"; } System.out.println(ans); } }