use std::io::*; use std::str::FromStr; fn calc(x: i64, mx: i64) -> i64 { if x % 2 == 1 { return 1; } let mut ret: i64 = 0; let mut i: i64 = 1; while i <= x { if x % i == 0 { if i <= mx && i > ret { ret = i } if x / i <= mx && x / i > ret { ret = x / i } } i *= 2; } ret } fn solve(a: i64, b: i64) { let mut ret: Vec = Vec::new(); let mut x = a; while x != b { if x + x <= b { ret.push(x); x += x; } else { let y = calc(x, b - x); ret.push(y); x += y; } } println!("{}", ret.len()); for i in 0..ret.len() { if i > 0 { print!(" "); } print!("{}", ret[i]); } println!(); } fn main() { let mut s = String::new(); stdin().read_line(&mut s).ok(); let mut itr = s.split_whitespace().map(|x| i32::from_str(x).unwrap()); let t = itr.next().unwrap(); for _i in 0..t { s.clear(); stdin().read_line(&mut s).ok(); let mut itr = s.split_whitespace().map(|x| i64::from_str(x).unwrap()); let (a, b) = (itr.next().unwrap(), itr.next().unwrap()); solve(a, b); } }