#![allow(unused_imports, unused_macros, unknown_lints)] use std::collections::*; use std::cmp::Ordering::*; macro_rules! dump {($($e:expr), +) => {print!(concat!($(stringify!($e), " = {:?}\n"), +), $($e), +)}} macro_rules! max {($e0:expr, $($e:expr), +) => {{let mut r = $e0; $(r = std::cmp::max(r, $e);)+ r}}} macro_rules! min {($e0:expr, $($e:expr), +) => {{let mut r = $e0; $(r = std::cmp::min(r, $e);)+ r}}} fn main() { let n = get::val::(); let ts = { let mut ts = vec![]; for _ in 0 .. n { let v = get::vec::(); let t = (v[0],v[1],v[2],v[3],v[4],v[5]); ts.push(t) } ts }; let is_kadomatsu = |a,b,c| a!=b&&b!=c&&c!=a && (b==max!(a,b,c) || b==min!(a,b,c)); for (x1,x2,x3,y1,y2,y3) in ts { if is_kadomatsu(x1,x2,x3) || is_kadomatsu(y1,y2,y3) { println!("YES"); continue } match (x1.cmp(&x2), x2.cmp(&x3), y1.cmp(&y2), y2.cmp(&y3)) { (Less,Less,Greater,Greater) | (Greater,Greater,Less,Less) => {println!("YES"); continue}, _ => () } if x1!=x2&&x2!=x3 && y1!=y2&&y2!=y3 && (x2==max!(x1,x2,x3) || x2==min!(x1,x2,x3) || y2==max!(y1,y2,y3) || y2==min!(y1,y2,y3)) && (x1!=y1 || x3!=y3) { println!("YES"); continue } println!("NO") } } #[allow(dead_code)] mod get { use std::io::*; use std::str::*; use std::process::*; pub fn val() -> T { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} buf.trim_right().parse::().ok().unwrap() } pub fn vals(n: usize) -> Vec { let mut vec: Vec = vec![]; for _ in 0 .. n { vec.push(val()); } vec } pub fn tuple() -> (T1, T2) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::().ok().unwrap(); let y = it.next().unwrap().parse::().ok().unwrap(); (x, y) } pub fn tuples(n: usize) -> Vec<(T1, T2)> { let mut vec: Vec<(T1, T2)> = vec![]; for _ in 0 .. n { vec.push(tuple()); } vec } pub fn tuple3() -> (T1, T2, T3) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::().ok().unwrap(); let y = it.next().unwrap().parse::().ok().unwrap(); let z = it.next().unwrap().parse::().ok().unwrap(); (x, y, z) } pub fn tuple3s(n: usize) -> Vec<(T1, T2, T3)> { let mut vec: Vec<(T1, T2, T3)> = vec![]; for _ in 0 .. n { vec.push(tuple3()); } vec } pub fn vec() -> Vec { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} buf.trim_right().split_whitespace().map(|t| t.parse::().ok().unwrap()).collect() } pub fn mat(h: usize) -> Vec> { let mut mat = vec![]; for _ in 0 .. h { mat.push(vec()); } mat } pub fn chars() -> Vec { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} buf.trim_right().chars().collect() } } #[allow(dead_code)] mod put { use std::string::*; pub fn vec(vec: &Vec, sep: &str) { let out = vec.iter().map(|e| e.to_string()).collect::>().as_slice().join(sep); println!("{}", out); } pub fn mat(mat: &Vec>, sep: &str) { for v in mat { vec(v, sep); } } }