fn main() { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).ok(); let t: usize = buf.trim().parse::().unwrap(); for _ in 0..t { buf.clear(); std::io::stdin().read_line(&mut buf).ok(); buf.clear(); std::io::stdin().read_line(&mut buf).ok(); let mut a: Vec = buf.trim().split(' ').map(|x|x.parse::().unwrap()).collect::>(); let mut mdl = 2u64; loop { let mut one = false; let mut zero = false; for x in &mut a { if *x & 1 == 0 { zero = true; } else { one = true; } *x >>= 1; } if zero && one { println!("{mdl}"); break; } mdl <<= 1; } } }