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.util.*;
  import java.lang.*;
  import java.math.BigInteger;
  
  import java.io.*;
  
  public class Main implements Runnable {
  
      public static void main(String[] args) {
          new Thread(null, new Main(), "whatever", 1 << 26).start();
      }
  
  
      private FastScanner sc;
      private PrintWriter pw;
  
      public void run() {
          try {
              // pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
              // sc = new FastScanner(new BufferedReader(new FileReader("input.txt")));
              pw = new PrintWriter(System.out);
              sc = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
          } catch (Exception e) {
              throw new RuntimeException();
          }
          int t = sc.nextInt();
          // int t = 1;
          while (t-- > 0) {
              // sc.nextLine();
              solve();
          }
          pw.close();
      }
  
      public long mod = 1_000_000_007;
      int n, a, b;
      public int[][][] dp;
      HashSet<Integer> set;
  
      public void solve() {
          a = sc.nextInt();
          b = sc.nextInt();
          if (a < b) {
              a = a + b;
              b = a - b;
              a = a - b;
          }
          // dp = new int[a + 1][b + 1][2];
  
          // for (int i = 0; i <= a; i++) {
          //     for (int j = 0; j <= b; j++) {
          //         dp[i][j][0] = -1;
          //         dp[i][j][1] = -1;
          //     }
          // }
  
          // set = new HashSet<>();
          n = a + b;
  
          // func(true, 0, 0, 0, 0);
          // func(false, 0, 0, 0, 0);
  
          // pw.println("Actual Answer  ->  " + set.size());
          // for (int i : set) {
          //     pw.print(i + " ");
          // }
          // pw.println();
  
  
          // pw.print("Computer Answer  ->  ");
          if (n % 2 == 0) {
              int size = (b + 1);
              pw.println(size);
              int temp = n / 2;
              int start = temp - b;
              for (int i = start, j = 0; j < size; j++, i += 2) {
                  pw.print(i + " ");
              }
              pw.println();
          } else {
              int size = (b + 1) * 2;
              pw.println(size);
              int temp = n / 2;
              int start = temp - b;
              for (int i = start, j = 0; j < size; i++, j++) {
                  pw.print(i + " ");
              }
              pw.println();
          }
  
  
  
      }
  
      // public void func(boolean isATurn, int pos, int aa, int bb, int numberOfBreaks) {
      //     if (aa > a || bb > b) {
      //         return;
      //     }
      //     if (pos == n) {
      //         set.add(numberOfBreaks);
      //         return;
      //     }
  
      //     // if (isATurn && dp[aa][bb][0] != -1) {
      //     //     pw.println("INSIDE 1 for pos=" + pos + " , aa=" + aa + " and bb=" + bb + " , numberOfBreaks=" + numberOfBreaks);
      //     //     return;
      //     // }
  
      //     // if (!isATurn && dp[aa][bb][1] != -1) {
      //     //     pw.println("INSIDE 2 for pos=" + pos + " , aa=" + aa + " and bb=" + bb + " , numberOfBreaks=" + numberOfBreaks);
      //     //     return;
      //     // }
  
      //     if (isATurn) {
      //         func(false, pos + 1, aa + 1, bb, numberOfBreaks);
      //         func(false, pos + 1, aa, bb + 1, numberOfBreaks + 1);
      //         dp[aa][bb][0] = 1;
      //     } else {
      //         func(true, pos + 1, aa, bb + 1, numberOfBreaks);
      //         func(true, pos + 1, aa + 1, bb, numberOfBreaks + 1);
      //         dp[aa][bb][1] = 1;
      //     }
      // }
  
  
  
  
  
  
  
  
      class FastScanner {
          private BufferedReader reader = null;
          private StringTokenizer tokenizer = null;
  
          public FastScanner(BufferedReader bf) {
              reader = bf;
              tokenizer = null;
          }
  
          public String next() {
              if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                  try {
                      tokenizer = new StringTokenizer(reader.readLine());
                  } catch (IOException e) {
                      throw new RuntimeException(e);
                  }
              }
              return tokenizer.nextToken();
          }
  
          public String nextLine() {
              if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                  try {
                      return reader.readLine();
                  } catch (IOException e) {
                      throw new RuntimeException(e);
                  }
              }
              return tokenizer.nextToken("\n");
          }
  
          public long nextLong() {
              return Long.parseLong(next());
          }
  
          public int nextInt() {
              return Integer.parseInt(next());
          }
  
          public double nextDouble() {
              return Double.parseDouble(next());
          }
  
          public float nextFloat() {
              return Float.parseFloat(next());
          }
  
          public int[] nextIntArray(int n) {
              int[] a = new int[n];
              for (int i = 0; i < n; i++) {
                  a[i] = nextInt();
              }
              return a;
          }
  
          public String[] nextStringArray(int n) {
              String[] a = new String[n];
              for (int i = 0; i < n; i++) {
                  a[i] = next();
              }
              return a;
          }
  
          public long[] nextLongArray(int n) {
              long[] a = new long[n];
              for (int i = 0; i < n; i++) {
                  a[i] = nextLong();
              }
              return a;
          }
  
      }
  }
  