def target_index(l, x, default=999): if x in l: return l.index(x) else: return default list_0 = input().split('.') list_1 = input().split('.') rel = [] for i in range(3): if int(list_0[i]) == int(list_1[i]): rel.append(0) elif int(list_0[i]) > int(list_1[i]): rel.append(-1) elif int(list_0[i]) < int(list_1[i]): rel.append(1) judge_list = [i <= 0 for i in rel] res = 0 if all(judge_list) == True: res = 1 if target_index(rel, -1) == 0: res = 1 else: res = 0 if res == 1: print('YES') else: print('NO')