from itertools import product from typing import Sequence def is_kadomatsu(numbers: Sequence[int]) -> bool: assert len(numbers) == 3 if numbers[0] == numbers[2]: return False if numbers[0] < numbers[1] and numbers[1] > numbers[2]: return True if numbers[0] > numbers[1] and numbers[1] < numbers[2]: return True return False def main(): a = list(map(int, input().split())) b = list(map(int, input().split())) for idx1, idx2 in product(range(3), repeat=2): a_copy = a[:] b_copy = b[:] a_copy[idx1], b_copy[idx2] = b_copy[idx2], a_copy[idx1] if is_kadomatsu(a_copy) and is_kadomatsu(b_copy): print("Yes") return else: print("No") if __name__ == "__main__": main()