import itertools 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) seq = [0,1,2] One = [[1,0,2],[2,1,0],[0,2,1]] Two = [[1,2,0],[2,0,1]] for x in One: if P[0] == Q[x[0]] and P[1] == Q[x[1]] and P[2] == Q[x[2]]: print("Yes") print(2);exit() for x in Two: if P[0] == Q[x[0]] and P[1] == Q[x[1]] and P[2] == Q[x[2]]: print("Yes") print(2);print(2);exit() if P[0] == Q[seq[0]] and P[1] == Q[seq[1]] and P[2] == Q[seq[2]]: print("Yes") print(2);print(2);exit() print("No")