t=int(input()) ab=[list(map(int,input().split())) for _ in range(t)] for a,b in ab: ary=[] while b>a: t=b-a t=1<<(t.bit_length()-1) while a%t!=0: t>>=1 ary.append(t) a+=t assert a==b,(a,b) print(len(ary)) print(*ary)