A = list(map(int, input().split())) B = list(map(int, input().split())) S = sorted(A) T = sorted(B) for i in range(3): if S[i] != T[i]: print('No') break else: print('Yes') print(2)