t=int(input()) for _ in range(t): a,b=map(int,input().split()) moves=[] cnt=0 for i in range(1,100): if a%(2**i)==0: cnt=i else: break for i in range(cnt,100): if 2**i<=(b-a): moves.append(2**i) a+=2**i else: break flag=format(b-a,'b') l=len(flag) for i in range(l): if flag[i]=='1': moves.append(2**(l-i-1)) a+=2**(l-i-1) print(len(moves)) print(*moves)