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.*;
   
  public class _1561b {
      FastScanner scn;
      PrintWriter w;
      PrintStream fs;
  
      long MOD = 1000000007;
      int N=100000+10;
      long mul(long x, long y) {long res = x * y; return (res >= MOD ? res % MOD : res);}
      long power(long x, long y) {if (y < 0) return 1; long res = 1; x %= MOD; while (y!=0) {if ((y & 1)==1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
      void ruffleSort(int[] a) {int n=a.length;Random r=new Random();for (int i=0; i<a.length; i++) {int oi=r.nextInt(n), temp=a[i];a[i]=a[oi];a[oi]=temp;}Arrays.sort(a);}
      boolean LOCAL;
      void debug(Object... o){if(LOCAL)System.err.println(Arrays.deepToString(o));}
      
      void solve(){
  
          int t=scn.nextInt();
              while(t-->0)
              {
                  int a=scn.nextInt(),b=scn.nextInt();
                  int s=a+b;
                  if((s&1)==0){
                  int min=Integer.MAX_VALUE,max=Integer.MIN_VALUE;
                      int turns=s/2;
                      if(a==turns&&b==turns){
                          min=0;
                          max=s;
                      }else{
                          if(a>s/2){
                              min=a-s/2;
                          }else if(b>s/2){
                              min=b-s/2;
                          }
                          max=(s/2)+(s/2-min);
                      }
                      debug("min",min,"max",max);
                      ArrayList<Integer> hs=new ArrayList<>();
                      for(int i=min;i<=max;i+=2){
                          hs.add(i);
                      }
                      w.println(hs.size());
                      for(int e:hs){
                          w.print(e+" ");
                      }
                      w.println();
                  }else{
                  int min=Integer.MAX_VALUE,max=Integer.MIN_VALUE;
                  int minTurns=s/2;
                  int maxTurns=minTurns+1;
                      if(a>=maxTurns){
                          min=a-maxTurns;
                      }else if(b>=maxTurns){
                          min=b-maxTurns;
                      }
                      max=maxTurns+(minTurns-min);
                      ArrayList<Integer> hs=new ArrayList<>();
                      for(int i=min;i<=max;i++){
                          hs.add(i);
                      }
                      w.println(hs.size());
                      for(int e:hs){
                          w.print(e+" ");
                      }
                      w.println();
                  }
              
              
              }
          
      }
   
      void run() {
          try {
              long ct = System.currentTimeMillis();
              scn = new FastScanner(new File("input.txt"));
              w = new PrintWriter(new File("output.txt"));
              fs=new PrintStream("error.txt");
              System.setErr(fs);
              LOCAL=true;
   
              solve();
   
              w.close();
              System.err.println(System.currentTimeMillis() - ct);
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          }
      }
   
      void runIO() {
   
          scn = new FastScanner(System.in);
          w = new PrintWriter(System.out);
          LOCAL=false;
   
          solve();
   
          w.close();
      }
   
      class FastScanner {
          BufferedReader br;
          StringTokenizer st;
   
          public FastScanner(File f) {
              try {
                  br = new BufferedReader(new FileReader(f));
              } catch (FileNotFoundException e) {
                  e.printStackTrace();
              }
          }
   
          public FastScanner(InputStream f) {
              br = new BufferedReader(new InputStreamReader(f));
          }
   
          String next() {
              while (st == null || !st.hasMoreTokens()) {
                  String s = null;
                  try {
                      s = br.readLine();
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
                  if (s == null)
                      return null;
                  st = new StringTokenizer(s);
              }
              return st.nextToken();
          }
   
          boolean hasMoreTokens() {
              while (st == null || !st.hasMoreTokens()) {
                  String s = null;
                  try {
                      s = br.readLine();
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
                  if (s == null)
                      return false;
                  st = new StringTokenizer(s);
              }
              return true;
          }
   
          int nextInt() {
              return Integer.parseInt(next());
          }
          
          int[] nextIntArray(int n) {
              int a[] = new int[n];
              for (int i = 0; i < n; i++) {
                  a[i] = nextInt();
              }
              return a;
          }
  
          long[] nextLongArray(int n) {
              long a[] = new long[n];
              for (int i = 0; i < n; i++) {
                  a[i] = nextLong();
              }
              return a;
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
   
          double nextDouble() {
              return Double.parseDouble(next());
          }
      }
   
      public static void main(String[] args) {
          new _1561b().runIO();
      }
  }
  