A = set(list(map(int,input().split()))) B = set(list(map(int,input().split()))) if len(A & B) <= 1: print("Yes") else: print("No")