import sys sys.setrecursionlimit(10**7) memo={} def main(a,b): if (a,b) in memo:return memo[(a,b)] if b-a<3:return [1]*(b-a) if b==a:return [] if b==a+1:return [1] if b==a+2 and a%2==0:return [2] if b==a+2:return [1,1] if 2*a<=b: ret=[a]+main(2*a,b) memo[(a,b)]=ret return ret ary=[] if a%2==1: ary.append(1) a+=1 d=2 while a+a//d>b and a%(2*d)==0: d*=2 if a+a//d<=b: ary.append(a//d) ary+=main(a+a//d,b) memo[(a,b)]=ary return ary else: while a+d>b: d//=2 ary.append(d) ary+=main(a+d,b) memo[(a,b)]=ary return ary def chk(a,b,ret): if len(ret)>120:return False,0,ret for x in ret: if a%x==0: a+=x else: return False,1,ret return a==b,2,ret t=int(input()) cases=[list(map(int,input().split())) for _ in range(t)] for a,b in cases: ret=main(a,b) print(len(ret)) print(*ret)