A = sorted(map(int, input().split())) B = sorted(map(int, input().split())) if A == B: print("Yes") print(2) else: print("No")