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