# 門松列かどうかを判定する関数 def is_kadomatsu(a, b, c): if a == b or b == c or a == c: return False return (b > a and b > c) or (b < a and b < c) # 1. 入力をリストとして受け取る A = list(map(int, input().split())) # 1つ目の数列 B = list(map(int, input().split())) # 2つ目の数列 can_make = False # 2. 全通りの交換を試す (3 × 3 = 9通り) for i in range(3): # Aの何番目を選ぶか for j in range(3): # Bの何番目を選ぶか # --- 交換作業 --- # 一時的にリストをコピーして、要素を入れ替える temp_A = A[:] # リストをコピー temp_B = B[:] # A[i] と B[j] を交換 temp_A[i], temp_B[j] = temp_B[j], temp_A[i] # --- 判定 --- # 両方のリストが門松列になっているかチェック if is_kadomatsu(temp_A[0], temp_A[1], temp_A[2]) and \ is_kadomatsu(temp_B[0], temp_B[1], temp_B[2]): can_make = True break # 1つでも見つかれば、内側のループを抜ける # 3. 結果の出力 if can_make: print("Yes") else: print("No")