A = list(map(int,input().split()))
B = list(map(int,input().split()))

for i in range(3):
    for j in range(3):
        a = A.copy()
        b = B.copy()
        a[i],b[j] = b[j],a[i]
        if len(set(a)) == 3 and len(set(b)) == 3 and (min(a) == a[1] or max(a) == a[1]) and (min(b) == b[1] or max(b) == b[1]):
            print("Yes")
            exit()
print("No")