import sys A = list(map(int,input().split())) D = list(map(int,input().split())) flag = True for i in range(3): if A[i] != D[i]: flag = False break else: print ("Yes") sys.exit() A.sort() D.sort() flag = True for i in range(3): if A[i] != D[i]: flag = False break else: print ("Yes") print (2) sys.exit() print ("No")