X = list(map(int, input().split()))
Y = list(map(int, input().split()))
if sorted(X) != sorted(Y):
    print("No")
    exit()
print("Yes")
print(2)