list_0 = input().split('.') list_1 = input().split('.') rel = [] for i in range(3): if list_0[i] == list_1[i]: rel.append(0) elif list_0[i] > list_1[i]: rel.append(-1) elif list_0[i] < list_1[i]: rel.append(1) judge_list = [i <= 0 for i in rel] if all(judge_list) or rel.index(-1) == 0: res = 1 else: res = 0 if res == 1: print('YES') else: print('NO')