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.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.HashSet;
  import java.util.List;
  import java.util.StringTokenizer;
  
  public class _1561_B {
  
      private static final FastScanner in = new FastScanner();
      private static final PrintWriter out = new PrintWriter(System.out);
      private static final PrintWriter err = new PrintWriter(System.err);
  
      /*
      0 0 0
      1 1 0 2
      2 2 0 2 4
      3 3 0 2 4 6
  
      0 1 0 1
      0 2 1
      0 3 1 2
      0 4 2
      0 5 2 3
      0 6 3
      0 7 3 4
       */
      public static void solve() {
          int a = in.nextInt();
          int b = in.nextInt();
  
          int diff = Math.abs(a - b);
          ArrayList<Integer> add = new ArrayList<>();
          if (diff % 2 == 0) {
              add.add(diff/2);
          } else {
              add.add(diff/2);
              add.add(diff/2 + 1);
          }
          int draw = Math.min(a, b);
  
          ArrayList<Integer> eq = new ArrayList<>();
          for (int i = 0; i <= draw * 2; i+=2) {
              eq.add(i);
          }
  
          HashSet<Integer> exists = new HashSet<>();
          ArrayList<Integer> ans = new ArrayList<>();
          for (int e : eq) {
              for (int ad : add) {
                  if (!exists.contains(e + ad)) {
                      ans.add(e + ad);
                      exists.add(e + ad);
                  }
              }
          }
  
          Collections.sort(ans);
  
          out.println(ans.size());
          for (int an : ans) {
              out.print(an + " ");
          }
          out.println();
      }
  
      // Boilerplate
      public static void main(String[] args) {
          int t = in.nextInt();
          while (t-- > 0) {
              solve();
          }
  
          err.close();
          out.close();
      }
  
      @SuppressWarnings("unused")
      static class FastScanner {
  
          StringTokenizer tok = new StringTokenizer("");
          BufferedReader in;
  
          FastScanner() {
              in = new BufferedReader(new InputStreamReader(System.in));
          }
  
          String next() {
              while (!tok.hasMoreElements()) {
                  try {
                      tok = new StringTokenizer(in.readLine());
                  } catch (IOException e) {
                      throw new RuntimeException(e);
                  }
              }
  
              return tok.nextToken();
          }
  
          String nextLine() {
              String line;
              try {
                  line = in.readLine();
              } catch (IOException e) {
                  throw new RuntimeException(e);
              }
              return line;
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          int[] nextIntArray(int n) {
              int[] arr = new int[n];
              for (int i = 0; i < n; i++) {
                  arr[i] = nextInt();
              }
              return arr;
          }
  
          List<Integer> nextIntegerList(int n) {
              ArrayList<Integer> list = new ArrayList<>(n);
              for (int i = 0; i < n; i++) {
                  list.add(nextInt());
              }
              return list;
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          long[] nextLongArray(int n) {
              long[] arr = new long[n];
              for (int i = 0; i < n; i++) {
                  arr[i] = nextLong();
              }
              return arr;
          }
  
          List<Long> nextLongList(int n) {
              ArrayList<Long> list = new ArrayList<>(n);
              for (int i = 0; i < n; i++) {
                  list.add(nextLong());
              }
              return list;
          }
  
          ArrayList<Integer>[] nextGraph(int n, int m) {
              @SuppressWarnings("unchecked")
              ArrayList<Integer>[] adj = (ArrayList<Integer>[]) new ArrayList[n];
  
              for (int i = 0; i < n; i++) {
                  adj[i] = new ArrayList<>();
              }
  
              for (int i = 0; i < m; i++) {
                  int v = nextInt();
                  int t = nextInt();
                  adj[v - 1].add(t - 1);
                  adj[t - 1].add(v - 1);
              }
  
              return adj;
          }
      }
  }