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() { if b - a <= 120 { println!("{}", b-a); println!("{}", vec!["1"; b-a].join(" ")); continue; } let mut target = a; let mut op = vec![]; while target < b { if target * 2 <= b { op.push(target); target *= 2; continue; } if target % 2 == 1 { op.push(1); target += 1; continue; } for i in 2.. { if target % i > 0 { continue; } if target + target / i > b { continue; } op.push(target / i); target += target / i; } } println!("{}", op.len()); println!("{}", op.iter().map(|v| v.to_string()).collect::>().join(" ")); } }