list_0 = input().split('.') list_1 = input().split('.') flag = 1 # 後者が化石という前提 for i in range(3): if int(list_0[i]) < int(list_1[i]): flag = flag * 0 if flag: print('YES') else: print('NO')