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 MyPackage;
  import java.io.*;
  import java.util.*;
  public class MyClass {
      final static long mod = 1_000_000_007;
      final static int mini = Integer.MIN_VALUE;
      final static int maxi = Integer.MAX_VALUE;
      static long gcd(long a, long b) {
          if (b == 0) return a;
          return gcd(b, a % b);
      }
      static long ncr(long n, long r) {
          if (r > n - r) r = n - r;
          long[] C = new long[(int) r + 1];
          C[0] = 1;
          for (int i = 1; i <= n; i++) {
              for (long j = Math.min(i, r); j > 0; j--)
                  C[(int) j] = (C[(int) j] + C[(int) j - 1]) % mod;
          }
          return C[(int) r];
      }
      static boolean isPrime(long n) {
          if (n <= 1)
              return false;
          else if (n == 2)
              return true;
          else if (n % 2 == 0)
              return false;
          for (int i = 3; i <= Math.sqrt(n); i += 2) {
              if (n % i == 0)
                  return false;
          }
          return true;
      }
      static boolean isSquare(long x) {
          if (x >= 0) {
              long sr = (long) Math.sqrt(x);
              return ((sr * sr) == x);
          }
          return false;
      }
      static int countSetBits(int n) {
          int count = 0;
          while(n > 0) {
              n &= (n - 1);
              count++;
          }
          return count;
      }
      static int digits(long n) {
          int count = 0;
          long temp = n;
          while (temp > 0) {
              temp /= 10;
              count++;
          }
          return count;
      }
      static boolean isPalindrome(long i) {
          long originalNum = i;
          long remainder;
          long reversedNum = 0;
          while (i != 0) {
              remainder = i % 10;
              reversedNum = reversedNum * 10 + remainder;
              i /= 10;
          }
          return originalNum == reversedNum;
      }
      static long lcm(long a, long b) {
          return (a / gcd(a, b)) * b;
      }
      static void sort(long[] a) {
          ArrayList<Long> l = new ArrayList<>();
          for (long value : a) {
              l.add(value);
          }
          Collections.sort(l);
          for (int i = 0; i < l.size(); i++)
              a[i] = l.get(i);
      }
      static void sort(int[] a) {
          ArrayList<Integer> l = new ArrayList<>();
          for (int value : a) {
              l.add(value);
          }
          Collections.sort(l);
          for (int i = 0; i < l.size(); i++)
              a[i] = l.get(i);
      }
      static void reverse(int[] arr) {
          int l = 0;
          int h = arr.length - 1;
          while (l < h) {
              swap(arr, l, h);
              l++;
              h--;
          }
      }
      static String reverse(String s) {
          StringBuilder res = new StringBuilder(s);
          return res.reverse().toString();
      }
      static long fact(long n) {
          long res = 1, i;
          for (i = 2; i <= n; i++)
              res *= i;
          return res;
      }
      static void swap(int[] arr, int i, int j) {
          int temp = arr[i];
          arr[i] = arr[j];
          arr[j] = temp;
      }
      static class FastReader {
          BufferedReader br;
          StringTokenizer st;
  
          public FastReader() {
              br = new BufferedReader(new InputStreamReader(System.in));
          }
  
          String n() {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
  
          int nint() {
              return Integer.parseInt(n());
          }
  
          long nlong() {
              return Long.parseLong(n());
          }
  
          double ndouble() {
              return Double.parseDouble(n());
          }
  
          int[] narr(int n) {
              int[] a = new int[n];
              for (int i = 0; i < n; i++) a[i] = nint();
              return a;
          }
  
          int[][] narr(int n, int m) {
              int[][] a = new int[n][m];
              for (int i = 0; i < n; i++)
                  for (int j = 0; j < m; j++)
                      a[i][j] = nint();
              return a;
          }
  
          String nline() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
      }
      public static class Pair {
          long a;
          long b;
  
          public Pair(long a, long b) {
              this.a = a;
              this.b = b;
          }
      }
      public static void main(String[] args) {
          FastReader sc = new FastReader();
          PrintWriter out = new PrintWriter(System.out);
          int t = sc.nint();
          while(t-- > 0) {
              int a = sc.nint();
              int b = sc.nint();
              TreeSet<Integer> set = new TreeSet<>();
              int tot = a + b;
              int f = tot / 2;
              int s = tot - f;
              for(int i = 0; i <= Math.min(a, f); i++) {
                  if(a - i <= s) {
                      set.add(a - i + f - i);
                  }
              }
              for(int i = 0; i <= Math.min(a, s); i++) {
                  if(a - i <= f) {
                      set.add(a - i + s - i);
                  }
              }
              out.println(set.size());
              for(int i : set) {
                  out.print(i + " ");
              }
              out.println();
          }
          out.flush();
          out.close();
      }
  }