A,B,C = map(int,input().split()) D,E,F = map(int,input().split()) P = [A,B,C]; PS = set(P) Q = [D,E,F]; QS = set(Q) if PS != QS: print("No") else: if P == Q: print("Yes") elif A == D or B == E or C == F: print("Yes") print(2) else: print("Yes") print(2) print(2)