package main import ( "bufio" "fmt" "os" ) func main() { defer writer.Flush() T := ReadInt() for t := uint64(0); t < T; t++ { A, B := ReadInt(), ReadInt() solve(A, B) } } func solve(A, B uint64) { ans := make([]uint64, 0) N := 60 var l int for i := N; i >= 0; i-- { if A>>i&1 < B>>i&1 { l = i break } } for i := 0; i < l; i++ { if A>>i&1 == 1 { A += 1 << i ans = append(ans, 1<= 0; i-- { if A>>i&1 == 0 && B>>i&1 == 1 { ans = append(ans, 1< 0 { Printf(" ") } Printf("%d", ans[i]) } Println() } var reader = bufio.NewReader(os.Stdin) func Scan(a ...interface{}) { if _, err := fmt.Fscan(reader, a...); err != nil { panic(err) } } func ReadInt() (i uint64) { Scan(&i); return } var writer = bufio.NewWriter(os.Stdout) func Printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) } func Println(a ...interface{}) { fmt.Fprintln(writer, a...) }