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