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: // package com.company
  
  /*
   * @author :: Yuvraj Singh
   * CS UNDERGRAD AT IT GGV BILASPUR
   */
  
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.math.BigInteger;
  import java.util.*;
  
  import static java.lang.Math.*;
  import static java.lang.System.out;
  import static java.lang.Long.MAX_VALUE;
  
  public final class Main {
  
      FastReader in;
      StringBuffer sb;
      public static void main(String[] args) {
          new Main().run();
      }
  
      void run(){
          in= new FastReader();
          start();
      }
  
      void start(){
          sb= new StringBuffer();
          for(int t=in.nextInt();t>0;t--)
              solve();
          out.print(sb);
      }
  
      void solve(){
          int a= in.nextInt();
          int b= in.nextInt();
          if(a<b){
              int tmp= a;
              a= b;
              b= tmp;
          }
          int diff=a-b;
  //        sb.append(diff).append("\n");
          ArrayList<Integer> arr= new ArrayList<>();
          for(int i=0;i<=2*b;i+=2)
              arr.add(i);
  
          if(b==0){
              arr.remove(arr.size()-1);
          }
          Set<Integer> ans= new HashSet<>();
          if(diff%2!=0){
              for(int i=0;i<arr.size();i++){
                  ans.add(arr.get(i)+diff/2);
                  ans.add(arr.get(i)+diff/2+1);
              }
              ans.add(diff/2);
              ans.add(diff/2 + 1);
          }
          else {
              for(int i=0;i<arr.size();i++){
                  ans.add(arr.get(i)+diff/2);
              }
              ans.add(diff/2);
          }
          ArrayList<Integer> ans1= new ArrayList<>(ans);
          Collections.sort(ans1);
          sb.append(ans1.size()).append("\n");
          for(Integer k:ans1)
              sb.append(k).append(" ");
          sb.append("\n");
      }
  
  
  
      void swap( int i , int j) {
          int tmp  = i;
          i = j;
          j = tmp;
      }
  
      long power(long x, long y, long p) {
          long res = 1;
          x = x % p;
          while (y > 0) {
              if (y % 2 == 1)
                  res = (res * x) % p;
  
              y = y >> 1;
              x = (x * x) % p;
          }
          return res;
      }
  
      int upper_bound(long[] arr, int key) {
          int i=0, j=arr.length-1;
          if (arr[j]<=key) return j+1;
          if(arr[i]>key) return i;
          while (i<j){
              int mid= (i+j)/2;
              if(arr[mid]<=key){
                  i= mid+1;
              }else{
                  j=mid;
              }
          }
          return i;
      }
  
      void sort(long[] A){
          int n = A.length;
          Random rnd = new Random();
          for(int i=0; i<n; ++i){
              long tmp = A[i];
              int randomPos = i + rnd.nextInt(n-i);
              A[i] = A[randomPos];
              A[randomPos] = tmp;
          }
          Arrays.sort(A);
      }
  
      int[] intArr(int n){
          int[] res= new int[n];
          for(int i=0;i<n;i++){
              res[i]= in.nextInt();
          }
          return res;
      }
  
      long[] longArr(int n){
          long[] res= new long[n];
          for(int i=0;i<n;i++){
              res[i]= in.nextLong();
          }
          return res;
      }
  
      // sieve of eratosthenes code for precomputing whether numbers are prime or not up to MAX_VALUE
      long MAX= MAX_VALUE;
      int[] precomp= new int[(int) (MAX+1)];
      void sieve(){
          long n= MAX;
          boolean[] prime = new boolean[(int) (n+1)];
          for(int i=0;i<=n;i++)
              prime[i] = true;
  
          for(long p = 2; p*p <=n; p++)
          {
              // If prime[p] is not changed, then it is a prime
              if(prime[(int) p])
              {
                  // Update all multiples of p
                  for(long i = p*p; i <= n; i += p)
                      prime[(int) i] = false;
              }
          }
  
          // Print all prime numbers
          for(long i = 2; i <= n; i++)
          {
              if(prime[(int) i])
                  precomp[(int) i]= 1;
          }
      }
  
      boolean isDigitSumPalindrome(long N) {
          // code here
          long sum= sumOfDigits(String.valueOf(N));
          long rev=0;
          long org= sum;
          while (sum!=0){
              long d= sum%10;
              rev = rev*10 +d;
              sum /= 10;
          }
          return org == rev;
      }
  
      long sumOfDigits(String n){
          long sum= 0;
          for (char c: n.toCharArray()){
              sum += Integer.parseInt(String.valueOf(c));
          }
          return sum;
      }
  
      long[] revArray(long[] arr) {
          int n= arr.length;
          int i=0, j=n-1;
          while (i<j){
              long temp= arr[i];
              arr[i]= arr[j];
              arr[j]= temp;
              i++;
              j--;
          }
          return arr;
      }
  
      long gcd(long a, long b){
          if (b==0)
              return a;
          return gcd(b, a%b);
      }
      long lcm(long a,long b){
          return (a*b)/gcd(a,b);
      }
  
      static class Pair{
          long first;
          long second;
          Pair(long x,long y){
              this.first=x;
              this.second=y;
          }
      }
  
      static class Compare {
          static void compare(ArrayList<Pair> arr, long n) {
              arr.sort(new Comparator<Pair>() {
                  @Override
                  public int compare(Pair p1, Pair p2) {
                      return (int) (p2.first - p1.first);
                  }
              });
          }
      }
  
      public 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 (Exception e){
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
          int nextInt(){
              return Integer.parseInt(next());
          }
          long nextLong(){
              return Long.parseLong(next());
          }
          double nextDouble(){
              return Double.parseDouble(next());
          }
          float nextFloat(){
              return Float.parseFloat(next());
          }
          String nextLine(){
              String str="";
              try{
                  str=br.readLine();
              }catch (Exception e){
                  e.printStackTrace();
              }
              return str;
          }
      }
  }