fn run<'a, I: Iterator>(mut scanner: I) { macro_rules! scan { ([$($t:tt),*]) => ([$(scan!($t)),*]); ($t:ty) => (scanner.next().unwrap().parse::<$t>().unwrap()); } macro_rules! input { ($($($v:ident)* : $t:tt),* $(,)?) => ($(let $($v)* = scan!($t);)*); } input! { mut a: [u8, u8, u8], mut b: [u8, u8, u8], } let is_kadomatsu = |a: &[u8]| { a[0] != a[1] && a[1] != a[2] && a[2] != a[0] && (a[0] < a[1] && a[1] > a[2] || a[0] > a[1] && a[1] < a[2]) }; for i in 0..3 { for j in 0..3 { std::mem::swap(&mut a[i], &mut b[j]); if is_kadomatsu(&a) && is_kadomatsu(&b) { println!("Yes"); return; } std::mem::swap(&mut a[i], &mut b[j]); } } println!("No"); } fn main() { let ref mut buf = Vec::new(); std::io::Read::read_to_end(&mut std::io::stdin(), buf).ok(); run(std::str::from_utf8(buf).unwrap().split_whitespace()); }