import sys sys.setrecursionlimit(10**7) def main(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) return ret ary=[] if a%2==1: ary.append(1) a+=1 d=2 while a+2*d<=b and a%(2*d)==0: d*=2 ary+=[d]+main(a+d,b) return ary def chk(a,b,ret): if len(ret)>120:return False,0,len(ret) for x in ret: if a%x==0: a+=x else: return False,1,x,ret return a==b,2,ret if __name__=='__main__': 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)