a = list(map(int,input().split())) b = list(map(int,input().split())) flag = False for i in range(3): a_array = a.copy() b_array = b.copy() for j in range(3): a_v = a_array[i] b_v = b_array[j] a_array[i] = b_v b_array[j] = a_v if len(set(a_array))==3 and len(set(b_array))==3 and (min(a_array)==a_array[1] or max(a_array)==a_array[1]): flag=True else: continue break if flag: print("Yes") else: print("No")