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.io.*;
  import java.math.*;
  import java.lang.*;
  
  public class CharmedGame {
      
      static int mod = 1000000007;
  
      public static class Reader {
          final private int BUFFER_SIZE = 1 << 16;
          private DataInputStream din;
          private byte[] buffer;
          private int bufferPointer, bytesRead;
   
          public Reader()
          {
              din = new DataInputStream(System.in);
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }
   
          public Reader(String file_name) throws IOException
          {
              din = new DataInputStream(
                  new FileInputStream(file_name));
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }
   
          public String readLine() throws IOException
          {
              byte[] buf = new byte[64]; // line length
              int cnt = 0, c;
              while ((c = read()) != -1) {
                  if (c == '\n') {
                      if (cnt != 0) {
                          break;
                      }
                      else {
                          continue;
                      }
                  }
                  buf[cnt++] = (byte)c;
              }
              return new String(buf, 0, cnt);
          }
   
          public int nextInt() throws IOException
          {
              int ret = 0;
              byte c = read();
              while (c <= ' ') {
                  c = read();
              }
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
   
              if (neg)
                  return -ret;
              return ret;
          }
   
          public long nextLong() throws IOException
          {
              long ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
              if (neg)
                  return -ret;
              return ret;
          }
   
          public double nextDouble() throws IOException
          {
              double ret = 0, div = 1;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
   
              do {
                  ret = ret * 10 + c - '0';
              } while ((c = read()) >= '0' && c <= '9');
   
              if (c == '.') {
                  while ((c = read()) >= '0' && c <= '9') {
                      ret += (c - '0') / (div *= 10);
                  }
              }
   
              if (neg)
                  return -ret;
              return ret;
          }
   
          private void fillBuffer() throws IOException
          {
              bytesRead = din.read(buffer, bufferPointer = 0,
                                   BUFFER_SIZE);
              if (bytesRead == -1)
                  buffer[0] = -1;
          }
   
          private byte read() throws IOException
          {
              if (bufferPointer == bytesRead)
                  fillBuffer();
              return buffer[bufferPointer++];
          }
   
          public void close() throws IOException
          {
              if (din == null)
                  return;
              din.close();
          }
      }
  
      public static void main(String[] args) throws Exception {
          Reader scn = new Reader();
          PrintWriter pw = new PrintWriter(System.out);
          int t = scn.nextInt();
          outer : while(t-->0){
              int a = scn.nextInt();
              int b = scn.nextInt();
              Set<Integer> hs = new HashSet<>();
              ArrayList<Integer> list = new ArrayList<>();
              int total = a + b;
              int p = 0, q = 0;
              //Case 1 : Alice serves first
              p = total / 2;
              if(total % 2 == 1){
              	p++;
              }
              q = total / 2;
              for(int x=0; x<=p; x++){
              	int y = a - p + x;
              	if(y >= 0 && y <= q){
              		hs.add(x + y);
              	}
              }
  
              // Case 2 : Borys serves first
              p = total / 2;
              q = total / 2;
              if(total % 2 == 1){
              	q++;
              }
              for(int y=0; y<=q; y++){
              	int x = b - q + y;
              	if(x >= 0 && x <= p){
              		hs.add(x + y);
              	} 
              }
              for(int key : hs){
              	list.add(key);
              }
              Collections.sort(list);
              pw.println(hs.size());
              for(int i=0; i<list.size(); i++){
              	pw.print(list.get(i) + " ");
              }
              pw.println();
          }
          pw.close();
      }
  
      public static class Pair{
          long x;
          long y;
  
          Pair(long x, long y){
              this.x = x;
              this.y = y;
          }
      }
  
      private static void sort(int[] arr) {
          List<Integer> list = new ArrayList<>();
          for (int i=0; i<arr.length; i++){
              list.add(arr[i]);
          }
          Collections.sort(list); // collections.sort uses nlogn in backend
          for (int i = 0; i < arr.length; i++){
              arr[i] = list.get(i);
          }
      }
  
      private static void sort(long[] arr) {
          List<Long> list = new ArrayList<>();
          for(int i=0; i<arr.length; i++){
              list.add(arr[i]);
          }
          Collections.sort(list); // collections.sort uses nlogn in backend
          for (int i = 0; i < arr.length; i++){
              arr[i] = list.get(i);
          }
      }
  
      private static int lowerBound(int[] arr, int x){
      	int n = arr.length, si = 0, ei = n - 1;
      	while(si <= ei){
      		int mid = si + (ei - si)/2;
      		if(arr[mid] == x){
      			if(mid-1 >= 0 && arr[mid-1] == arr[mid]){
      				ei = mid-1;
      			}else{
      				return mid;
      			}
      		}else if(arr[mid] > x){
      			ei = mid - 1; 
      		}else{
      			si = mid+1;
      		}
      	}
      	return si; 
      }
  
      private static int upperBound(int[] arr, int x){
      	int n = arr.length, si = 0, ei = n - 1;
      	while(si <= ei){
      		int mid = si + (ei - si)/2;
      		if(arr[mid] == x){
      			if(mid+1 < n && arr[mid+1] == arr[mid]){
      				si = mid+1;
      			}else{
      				return mid + 1;
      			}
      		}else if(arr[mid] > x){
      			ei = mid - 1; 
      		}else{
      			si = mid+1;
      		}
      	}
      	return si; 
      }
  
      // (x^y)%p in O(logy)
      private static long power(long x, long y){
          long res = 1; 
          x = x % mod;
          while(y > 0){
              if ((y & 1) == 1){
                  res = (res * x) % mod;
              }
              y = y >> 1; 
              x = (x * x) % mod;
          }
          return res;
      }
  
      // TC- O(logmax(a,b))
      private static int gcd(int a, int b) {
          if(a == 0){
              return b;
          }
          return gcd(b%a, a);
      }
  
      // TC- O(logmax(a,b))
      private static int lcm(int a, int b) {
          return a / gcd(a, b) * b;
      }
  }