using System; namespace yukicoder { class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split('.'); string[] s1 = Console.ReadLine().Split('.'); int count = 0; int []b = new int[3]; for (int i = 0; i < s.Length; i++) { int a = int.Parse(s[i]); int a1 = int.Parse(s1[i]); if (a >= a1) { b[i] += 1; count++; } } if (count == 3||b[0]>0&&b[1]>0&&b[2]>0) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } }