use std::mem::swap; fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let queries = (0..n).map(|_| { let mut temp = String::new(); std::io::stdin().read_line(&mut temp).ok(); let temp: Vec = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); (temp[0]-1, temp[1]-1, temp[2]-1, temp[3]-1) }) .collect::>(); let mut grid = (0..9).map(|i| (0..9).map(|j| i*9+j).collect::>()).collect::>(); for &(sx, sy, gx, gy) in queries.iter() { (grid[gx][gy], grid[sx][sy]) = (grid[sx][sy], grid[gx][gy]); } if grid[4][7] == 1*9+7 && grid[3][7] == 2*9+8 && grid[5][7] == 6*9+8 { println!("YES"); } else { println!("NO"); } }