function isK(a) { if (a[0] == a[1] || a[0] == a[2] || a[1] == a[2]) return false; if (!(a[0] > a[1] && a[1] < a[2]) || (a[0] < a[1] && a[1] > a[2])) return false; return true; } function sub(a, b) { let as = [...a]; let bs = [...b]; as.sort(); bs.sort(); if (as == bs) return "No"; for (let i = 0; i <= 2; i++) { for (let j = 0; j <= 2; j++) { let c = [...a]; let d = [...b]; c[j] = a[i]; d[i] = b[j]; if (isK(c) && isK(d)) return "Yes"; } } return "No"; } function Main(input) { let src = input.split("\n"); let a = src[0].split(" "); let b = src[1].split(" "); console.log(sub(a, b)); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));