a, b, c = map(int, input().split()) d, e, f = map(int, input().split()) if [a, b, c] == [d, e, f]: print("Yes") elif sorted([a, b, c]) == sorted([d, e, f]): print("Yes") print(2) else: print("No")