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.lang.*;
  import java.io.*;
  
  /* Name of the class has to be "Main" only if the class is public. */
  public class Main {
      public static void main(String[] args) throws java.lang.Exception {
          // your code goes here
          FastNum in = new FastNum(System.in);
          Reader sc = new Reader();
          PrintWriter out = new PrintWriter(System.out);
  
          int tests = in.nextInt();
  
          while(tests-->0){
              int a = in.nextInt();
              int b = in.nextInt();
  
              int n = a+b;
  
              boolean[] ans = new boolean[n+1];
  
              int count = 0;
  
              int A, B;
              if(n%2 == 0) {
                  A = n/2;
                  B = A;
                  for(int k = 0; k <= n; k++) {
                      if((a - A + k)%2 != 0 || (b - B + k)%2 != 0) continue;
  
                      int x = (a - A + k)/2;
                      int y = (b - B + k)/2;
                      if(x >= 0 && y >= 0 && x <= a && y <= b && x+y == k) {
                          ans[k] = true;
                          count++;
                      }
                  }
              }
              else {
                  A = n/2;
                  B = n - A;
                  for(int k = 0; k <= n; k++) {
  
                      if((a - A + k)%2 != 0 || (b - B + k)%2 != 0) continue;
  
                      int x = (a - A + k)/2;
                      int y = (b - B + k)/2;
                      if(x >= 0 && y >= 0 && x <= a && y <= b && x+y == k) {
                          ans[k] = true;
                          count++;
                      }
                  }
                  int t = B;
                  B = A;
                  A = t;
                  for(int k = 0; k <= n; k++) {
                      if((a - A + k)%2 != 0 || (b - B + k)%2 != 0) continue;
  
                      int x = (a - A + k)/2;
                      int y = (b - B + k)/2;
                      if(x >= 0 && y >= 0 && x <= a && y <= b && x+y == k) {
                          if(!ans[k]) {
                              ans[k] = true;
                              count++;
                          }
                      }
                  }
              }
  
              out.println(count);
              for(int i = 0; i <= n; i++) out.print(ans[i] ? i + " " : "");
              out.println();
  
  
          }
  
  
          out.flush();
      }
  
  
  
      public static long mod = 1000000007;
  
      public static long power(long x, long y, long p)
    {
      long res = 1; // Initialize result
  
      x = x % p; // Update x if it is more than or
      // equal to p
  
      if (x == 0)
        return 0; // In case x is divisible by p;
  
      while (y > 0)
      {
  
        // If y is odd, multiply x with result
        if ((y & 1) != 0)
          res = (res * x) % p;
  
        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
      }
      return res;
    }
  
  //    public static long power(long a, long b) {
  //        if (b == 0)
  //            return 1;
  //        long answer = power(a, b / 2) % mod;
  //        answer = (answer * answer) % mod;
  //        if (b % 2 != 0)
  //            answer = (answer * a) % mod;
  //        return answer;
  //    }
  
      public static void swap(int x, int y) {
          int t = x;
          x = y;
          y = t;
      }
  
      public static long min(long a, long b) {
          return a < b ? a : b;
      }
  
  //    public static long divide(long a, long b) {
  //        return (a % mod * (power(b, mod - 2) % mod)) % mod;
  //    }
  
      public static long nCr(long n, long r) {
          long answer = 1;
          long k = min(r, n - r);
          for (long i = 0; i < k; i++) {
              answer = (answer % mod * (n - i) % mod) % mod;
  //            answer = divide(answer, i + 1);
          }
          return answer % mod;
      }
  
      public static boolean plaindrome(String str) {
          StringBuilder sb = new StringBuilder();
          sb.append(str);
          return (str.equals((sb.reverse()).toString()));
      }
  
      static class Assert {
          static void check(boolean e) {
              if (!e) {
                  throw new AssertionError();
              }
          }
      }
  
      static class FastNum implements AutoCloseable {
  
          InputStream is;
          byte buffer[] = new byte[1 << 16];
          int size = 0;
          int pos = 0;
  
          FastNum(InputStream is) {
              this.is = is;
          }
  
          int nextChar() {
              if (pos >= size) {
                  try {
                      size = is.read(buffer);
                  } catch (IOException e) {
                      throw new IOError(e);
                  }
                  pos = 0;
                  if (size == -1) {
                      return -1;
                  }
              }
              Assert.check(pos < size);
              int c = buffer[pos] & 0xFF;
              pos++;
              return c;
          }
  
          int nextInt() {
              int c = nextChar();
              while (c == ' ' || c == '\r' || c == '\n' || c == '\t') {
                  c = nextChar();
              }
              if (c == '-') {
                  c = nextChar();
                  Assert.check('0' <= c && c <= '9');
                  int n = -(c - '0');
                  c = nextChar();
                  while ('0' <= c && c <= '9') {
                      int d = c - '0';
                      c = nextChar();
                      Assert.check(n > Integer.MIN_VALUE / 10
                              || n == Integer.MIN_VALUE / 10 && d <= -(Integer.MIN_VALUE % 10));
                      n = n * 10 - d;
                  }
                  return n;
              } else {
                  Assert.check('0' <= c && c <= '9');
                  int n = c - '0';
                  c = nextChar();
                  while ('0' <= c && c <= '9') {
                      int d = c - '0';
                      c = nextChar();
                      Assert.check(
                              n < Integer.MAX_VALUE / 10 || n == Integer.MAX_VALUE / 10 && d <= Integer.MAX_VALUE % 10);
                      n = n * 10 + d;
                  }
                  return n;
              }
          }
  
          @Override
          public void close() {
          }
      }
  
  
      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')
                      break;
                  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();
          }
      }
  }
  