import java.io.PrintWriter import java.util.* import kotlin.math.* fun isKadomatsu(a: Array): Boolean { return a.distinct().size == 3 && (a[1] == a.max()!! || a[1] == a.min()!!) } fun PrintWriter.solve() { val a = Array(3) { nextInt() } val b = Array(3) { nextInt() } for (i in 0 until 3) { for (j in 0 until 3) { val c = a.copyOf() val d = b.copyOf() c[i] = b[j] d[j] = a[i] if (isKadomatsu(c) && isKadomatsu(d)) { println("Yes") return } } } println("No") } fun main() { val writer = PrintWriter(System.out, false) writer.solve() writer.flush() } // region Scanner private var st = StringTokenizer("") private val br = System.`in`.bufferedReader() fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine()!! fun nextDouble() = next().toDouble() // endregion