old_version = list(map(int, (input().split('.')))) check_version = list(map(int, (input().split('.')))) flag = 0 for i in range(3): if int(old_version[i]) > int(check_version[i]): flag = 1 print('YES') break elif int(old_version[i] < int(check_version[i])): flag = 1 print('NO') break if flag == 0: print('YES')