import java.util.*; public class Main { static long[] base = new long[60]; public static void main (String[] args) { Scanner sc = new Scanner(System.in); base[0] = 1; for (int i = 1; i < base.length; i++) { base[i] = base[i - 1] * 2; } int t = sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < t; i++) { sb.append(getString(sc.nextLong(), sc.nextLong())).append("\n"); } System.out.print(sb); } static StringBuilder getString(long a, long b) { ArrayList list = new ArrayList<>(); for (int i = 1; i < base.length; i++) { if (a + base[i - 1] > b) { break; } if (a % base[i] != 0) { a += base[i - 1]; list.add(base[i - 1]); } } for (int i = base.length - 1; i >= 0; i--) { if (a + base[i] <= b) { list.add(base[i]); a += base[i]; } } StringBuilder sb = new StringBuilder(); sb.append(list.size()).append("\n"); for (int i = 0; i < list.size(); i++) { if (i > 0) { sb.append(" "); } sb.append(list.get(i)); } return sb; } }