list0 = [int(i) for i in input().split(".")] list1 = [int(i) for i in input().split(".")] flag = "" if list0[0] < list1[0]: flag = "NO" elif list0[0] == list1[0]: flag = "" else: flag = "YES" if flag == "": if list0[1] < list1[1]: flag = "NO" elif list0[1] == list1[1]: flag = "" else: flag = "YES" if flag == "": if list0[2] < list1[2]: flag = "NO" elif list0[2] == list1[2]: flag = "YES" else: flag = "YES" print(flag)