A1 = list(map(int, input().split())) A2 = list(map(int, input().split())) if sum(A1) != sum(A2): print("No") else: B1 = sorted(A1) B2 = sorted(A2) if B1 == B2: print("Yes") if A1 != A2: print(2) else: print(2) print(2) else: print("No")