//use rand::Rng; 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 { 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 rng = rand::thread_rng(); for _i in 0..1000 { let mut a: i64 = rng.gen_range(1, 1000000000000000000_i64); let mut b: i64 = rng.gen_range(1, 1000000000000000000_i64); if a > b { let c = a; a = b; b = c; } println!("{} {}", a, b); solve(a, b); } } */ 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); } }