p=list(map(int,input().split())) q=list(map(int,input().split())) def judge(l): return l[0]!=l[1] and l[1]!=l[2] and l[2]!=l[0] and (l[1]==max(l) or l[1]==min(l)) ans=False for i in range(3): for j in range(3): l1=p.copy() l2=q.copy() l1[i],l2[j]=l2[j],l1[i] if judge(l1) and judge(l2): ans=True print('Yes' if ans else 'No')