use std::io::Read; use std::io::Write; fn run() { let out = std::io::stdout(); let mut out = std::io::BufWriter::new(out.lock()); let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let q: usize = it.next().unwrap().parse().unwrap(); for _ in 0..q { let mut n: u64 = it.next().unwrap().parse().unwrap(); let mut h: u64 = it.next().unwrap().parse().unwrap(); let mut w: u64 = it.next().unwrap().parse().unwrap(); let d = *[h, w, n - 1 - h, n - 1 - w].iter().min().unwrap(); let mut ans = 4 * (n * d - d * d); h -= d; w -= d; n -= 2 * d; ans += if h == 0 { w } else if w == n - 1 { n - 1 + h } else if h == n - 1 { 2 * n - 2 + (n - 1 - w) } else { 3 * n - 3 + (n - 1 - h) }; writeln!(out, "{}", ans).ok(); } } fn main() { run(); }