fn main() { let mut t = String::new(); std::io::stdin().read_line(&mut t).ok(); let t: usize = t.trim().parse().unwrap(); for _ in 0..t { let mut ab = String::new(); std::io::stdin().read_line(&mut ab).ok(); let ab: Vec = ab.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let a = ab[0]; let b = ab[1]; let mut stack = vec![]; let astr = format!("{:b}", a).chars().collect::>(); let bstr = format!("{:b}", b).chars().collect::>(); let limit = bstr.len(); let limit = if astr.len() == limit { (1..=limit).rev().filter(|&i| astr[limit-i] != bstr[limit-i]).nth(0).unwrap() } else { limit }; let mut target = a; for i in 0..limit-1 { if ((target >> i) & 1) == 1 { let val = 1usize << i; stack.push(val); target += val; } } for i in (0..limit-1).rev() { if ((b >> i) & 1) == 1 { let val = 1usize << i; stack.push(val); target += val; } } println!("{}", stack.len()); println!("{}", stack.iter().map(|v| v.to_string()).collect::>().join(" ")); } }