package main import ( "bufio" "fmt" "os" ) func main() { defer writer.Flush() T := ReadInt() for t := 0; t < T; t++ { A, B := ReadInt(), ReadInt() solve(A, B) } } func solve(A, B int) { ans := make([]int, 0) N := 60 var l int for i := N; i >= 0; i-- { if A>>i&1 == 0 && B>>i&1 == 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 int) { Scan(&i); return } func ReadString() (s string) { Scan(&s); return } func ReadInts(n int) (a []int) { for i := 0; i < n; i++ { a = append(a, ReadInt()) } 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...) }