a,b,c=map(int,input().split()) d,e,f=map(int,input().split()) s=set([a,b,c]) t=set([d,e,f]) if len(s-t)!=0: print('No') else: print('Yes') if a==d and b==e and c==f: pass else: print(2)