a = list(map(int, input().split())) b = list(map(int, input().split())) def is_kadomatsu(a): return True if a.index(max(a))==1 or a.index(min(a))==1 else False for i in range(len(a)): for j in range(len(b)): a[i], b[j] = b[j], a[i] if is_kadomatsu(a) and is_kadomatsu(b): print("Yes") exit() a[i], b[j] = b[j], a[i] print("No")