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.util.*;
  
  
  public class javacp{
  
  
      static FastReader fs=new FastReader();
      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;
          }
  
          int[] inputIntArray(int n){
              int[] arr = new int[n];
              for(int i=0;i<n;i++)
                  arr[i] = fs.nextInt();
  
              return arr;
          }
      }
  
      static void sort(int[] arr){
          ArrayList<Integer> al = new ArrayList<>();
          for(int val : arr){
              al.add(val);
          }
  
          Collections.sort(al);
          for(int i=0;i<arr.length;i++){
              arr[i] = al.get(i);
          }
      }
  
      static class Pair {
          String str;
          int[] list;
  
          Pair(String str){
              this.str = str;
              list = new int[5];
          }
      }
  
      static class PairComparator implements Comparator<Pair>{
  
          int idx ;
          PairComparator(int idx){
              this.idx = idx;
          }
  
          @Override
          public int compare(Pair o1, Pair o2) {
              return (2*o2.list[idx]-o2.str.length())  - (2*o1.list[idx]-o1.str.length());
          }
      }
  
      static int[] par1 , rank1;
      static int[] par2;
      static int[] rank2;
  
      static void union1(int vt1 , int vt2){
          int parent1 = findParent1(vt1) , parent2 = findParent1(vt2);
          int r1 = rank1[parent1] , r2 =  rank1[parent2];
  
          if(r1 < r2)
              par1[parent1] = parent2;
          else par1[parent2] = parent1;
  
          if(r1 == r2) rank1[parent1]++;
      }
  
      static void union2(int vt1 , int vt2){
          int parent1 = findParent2(vt1) , parent2 = findParent2(vt2);
          int r1 = rank2[parent1] , r2 =  rank2[parent2];
  
          if(r1 < r2)
              par2[parent1] = parent2;
          else par2[parent2] = parent1;
  
          if(r1 == r2) rank2[parent1]++;
      }
  
      static int findParent1(int vt){
          if(par1[vt] == vt) return vt;
          par1[vt] = findParent1(par1[vt]);
  
          return par1[vt];
      }
  
      static int findParent2(int vt){
          if(par2[vt] == vt) return vt;
          par2[vt] = findParent2(par2[vt]);
  
          return par2[vt];
      }
  
      static void initialise(int numOfVtces){
          par1 = new int[numOfVtces];
          par2 = new int[numOfVtces];
  
          rank1 = new int[numOfVtces];
          rank2 = new int[numOfVtces];
  
          for(int i=0;i<numOfVtces;i++){
              par1[i] = par2[i] = i;
              rank1[i] = rank2[i] = 0;
          }
      }
  
  
      public static void main(String[] args) throws IOException{
  
          int t = 1;
          t = fs.nextInt();
  
          while (t-- > 0) {
              int a = fs.nextInt() , b = fs.nextInt();
              if((a+b) % 2 == 0){
                  int maxA = (a+b)/2 , maxB = (a+b)/2;
  
                  int min = Math.max(maxA-a,0)+Math.max(maxB-b,0);
                  int max = Math.min(maxA,b) + Math.min(maxB,a);
  
                  System.out.println((max-min)/2+1);
                  for(int i=min;i<=max;i+=2)
                      System.out.print(i+" ");
  
              }
              else{
                  int maxA = (a+b)/2 , maxB = (a+b)/2 + 1;
                  int min = Math.max(maxA-a,0)+Math.max(maxB-b,0);
                  int max = Math.min(maxA,b) + Math.min(maxB,a);
  
                  maxA = (a+b)/2 + 1;  maxB = (a+b)/2;
                  min = Math.min(min,Math.max(maxA-a,0)+Math.max(maxB-b,0));
                  max = Math.max(max,Math.min(maxA,b) + Math.min(maxB,a));
  
                  System.out.println(max-min+1);
                  for(int i=min;i<=max;i++)
                      System.out.print(i+" ");
              }
              System.out.println();
          }
      }
  
      static class CustomSort implements Comparator<int[]> {
  
          public int compare(int[] a, int[] b)
          {
              return a[1] - b[1];
          }
      }
  
      static void printArr(int[] arr){
          for(int i=0;i< arr.length;i++)
          {
              System.out.print(arr[i] + " ");
          }
          System.out.println();
      }
  
      private static int lcm(int a, int b) {
          int gcd = gcd(a,b);
          return (int)((long)a*(long)b)/gcd ;
      }
  
  
      private static int gcd(int a, int b) {
          if(b == 0) return a;
          else return gcd(b , a % b);
      }
  
  
      private static void swap(int[] arr, int start, int rand_pivot) {
          int temp = arr[start];
          arr[start] = arr[rand_pivot];
          arr[rand_pivot] = temp;
      }
  
  
  }