description: Alice and Borys are playing tennis.
  
  A tennis match consists of games. In each game, one of the players is serving and the other one is receiving.
  
  Players serve in turns: after a game where Alice is serving follows a game where Borys is serving, and vice versa.
  
  Each game ends with a victory of one of the players. If a game is won by the serving player, it's said that this player holds serve. If a game is won by the receiving player, it's said that this player breaks serve.
  
  It is known that Alice won a games and Borys won b games during the match. It is unknown who served first and who won which games.
  
  Find all values of k such that exactly k breaks could happen during the match between Alice and Borys in total.
  
  Input
  
  Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 10^3). Description of the test cases follows.
  
  Each of the next t lines describes one test case and contains two integers a and b (0 ≤ a, b ≤ 10^5; a + b > 0) — the number of games won by Alice and Borys, respectively.
  
  It is guaranteed that the sum of a + b over all test cases does not exceed 2 ⋅ 10^5.
  
  Output
  
  For each test case print two lines.
  
  In the first line, print a single integer m (1 ≤ m ≤ a + b + 1) — the number of values of k such that exactly k breaks could happen during the match.
  
  In the second line, print m distinct integers k_1, k_2, …, k_m (0 ≤ k_1 < k_2 < … < k_m ≤ a + b) — the sought values of k in increasing order.
  
  Example
  
  Input
  
  
  3
  2 1
  1 1
  0 5
  
  
  Output
  
  
  4
  0 1 2 3
  2
  0 2
  2
  2 3
  
  Note
  
  In the first test case, any number of breaks between 0 and 3 could happen during the match: 
  
    * Alice holds serve, Borys holds serve, Alice holds serve: 0 breaks; 
    * Borys holds serve, Alice holds serve, Alice breaks serve: 1 break; 
    * Borys breaks serve, Alice breaks serve, Alice holds serve: 2 breaks; 
    * Alice breaks serve, Borys breaks serve, Alice breaks serve: 3 breaks. 
  
  
  
  In the second test case, the players could either both hold serves (0 breaks) or both break serves (2 breaks).
  
  In the third test case, either 2 or 3 breaks could happen: 
  
    * Borys holds serve, Borys breaks serve, Borys holds serve, Borys breaks serve, Borys holds serve: 2 breaks; 
    * Borys breaks serve, Borys holds serve, Borys breaks serve, Borys holds serve, Borys breaks serve: 3 breaks. 
solution: import java.io.*;
  import java.util.*;
  import java.lang.*;
  
  public class Main{
      public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
      static long MOD = (long) (1e9 + 7);
      //    static long MOD = 998244353;
      static long MOD2 = MOD * MOD;
      static FastReader sc = new FastReader();
      static int pInf = Integer.MAX_VALUE;
      static int nInf = Integer.MIN_VALUE;
      static long ded = (long)(1e17)+9;
  
      public static void main(String[] args) throws Exception {
          int test = 1;
          test = sc.nextInt();
  
          for (int i = 1; i <= test; i++){
  //            out.print("Case #"+i+": ");
              solve();
          }
          out.flush();
          out.close();
      }
      static TreeSet<Integer> T;
      static void solve(){
          int a = sc.nextInt();
          int b = sc.nextInt();
          T = new TreeSet<>();
          int n = (a+b);
          solve(n/2,n-(n/2),a,b);
          solve(n-(n/2),n/2,a,b);
          out.println(T.size());
          for(int x: T){
              out.print(x+" ");
          }
          out.println();
      }
      static void solve(int A,int B,int a,int b){
          if(A<a){
              a = A;
          }
          if(B<b){
              b = B;
          }
          int diff = (A+B-(a+b));
          T.add(diff);
          for(int i = 1; i <= Math.min(a,b); i++){
              T.add((2*i)+diff);
          }
      }
      static class Pair implements Comparable<Pair> {
          long x;
          long y;
          public Pair(long x, long y) {
              this.x = x;
              this.y = y;
          }
          @Override
          public int compareTo(Pair o){
              if(this.x==o.x){
                  return Long.compare(this.y,o.y);
              }
              return Long.compare(this.x,o.x);
          }
  
          @Override
          public String toString() {
              return "Pair{" + "x=" + x + ", y=" + y + '}';
  //            return x+" "+y;
          }
  
          public boolean equals(Pair o){
              return this.x==o.x&&this.y==o.y;
          }
      }
      public static long mul(long a, long b) {
          return ((a % MOD) * (b % MOD)) % MOD;
      }
      public static long add(long a, long b) {
          if((a+b)>MOD){
              return a+b-MOD;
          }else{
              return a+b;
          }
  //        return ((a % MOD) + (b % MOD)) % MOD;
      }
      public static long c2(long n) {
          if ((n & 1) == 0) {
              return mul(n / 2, n - 1);
          } else {
              return mul(n, (n - 1) / 2);
          }
      }
      //Shuffle Sort
      static final Random random = new Random();
      static void ruffleSort(int[] a) {
          int n = a.length;//shuffle, then sort
          for (int i = 0; i < n; i++) {
              int oi = random.nextInt(n); int temp= a[oi];
              a[oi] = a[i];
              a[i] = temp;
          }
          Arrays.sort(a);
      }
      //Brian Kernighans Algorithm
      static long countSetBits(long n) {
          if (n == 0) return 0;
          return 1 + countSetBits(n & (n - 1));
      }
      //Euclidean Algorithm
      static long gcd(long A, long B) {
          if (B == 0) return A;
          return gcd(B, A % B);
      }
      //Modular Exponentiation
      static long fastExpo(long x, long n) {
          if (n == 0) return 1;
          if ((n & 1) == 0) return fastExpo((x * x) % MOD, n / 2) % MOD;
          return ((x % MOD) * fastExpo((x * x) % MOD, (n - 1) / 2)) % MOD;
      }
      //AKS Algorithm
      static boolean isPrime(long n) {
          if (n <= 1) return false;
          if (n <= 3) return true;
          if (n % 2 == 0 || n % 3 == 0) return false;
          for (int i = 5; i <= Math.sqrt(n); i += 6)
              if (n % i == 0 || n % (i + 2) == 0) return false;
          return true;
      }
      public static long modinv(long x) {
          return modpow(x, MOD - 2);
      }
      public static long modpow(long a, long b) {
          if (b == 0) {
              return 1;
          }
          long x = modpow(a, b / 2);
          x = (x * x) % MOD;
          if (b % 2 == 1) {
              return (x * a) % MOD;
          }
          return x;
      }
  
  
      static class FastReader {
          BufferedReader br;
          StringTokenizer st;
          public FastReader() {
              br = new BufferedReader(new InputStreamReader(System.in));
          }
  
          String next() {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          double nextDouble() {
              return Double.parseDouble(next());
          }
  
          String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
      }
  }