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: #include <bits/stdc++.h>
  using namespace std;
  long long int gcd(long long int a, long long int b) {
    if (a == 0) {
      return b;
    }
    return gcd(b % a, a);
  }
  long long int lcm(long long int a, long long int b) {
    return (a / gcd(a, b)) * b;
  }
  long long int ncr(long long int n, long long int r) {
    long long int p = 1, k = 1;
    if (n - r < r) r = n - r;
    if (r != 0) {
      while (r) {
        p *= n % 1000000007;
        k *= r % 1000000007;
        long long int m = gcd(p, k);
        p /= m;
        k /= m;
        n--;
        r--;
      }
    } else
      p = 1;
    return p % 1000000007;
  }
  long long int mod_exp(long long int a, long long int b, long long int m) {
    a %= m;
    long long int res = 1;
    while (b > 0) {
      if (b & 1) res = res * a % m;
      a = a * a % m;
      b = b / 2;
    }
    return res;
  }
  vector<long long int> get_div(long long int n) {
    vector<long long int> vec;
    for (long long int i = 1; i <= sqrt(n); i++) {
      if (n % i == 0) {
        if (n / i == i)
          vec.push_back(i);
        else {
          vec.push_back(i);
          vec.push_back(n / i);
        }
      }
    }
    return vec;
  }
  bool isPrime(long long int n) {
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (long long int i = 5; i * i <= n; i = i + 6)
      if (n % i == 0 || n % (i + 2) == 0) return false;
    return true;
  }
  vector<long long int> SieveOfEratosthenes(long long int n) {
    vector<long long int> arr(n + 1, 0);
    bool prime[n + 1];
    memset(prime, true, sizeof(prime));
    for (long long int p = 2; p * p <= n; p++) {
      if (prime[p] == true) {
        for (long long int i = p * p; i <= n; i += p) prime[i] = false;
      }
    }
    for (long long int j = 2; j <= n; j++) {
      arr[j] = arr[j - 1];
      if (prime[j]) arr[j]++;
    }
    return arr;
  }
  long long int primeFactors(long long int n, long long int k) {
    if (isPrime(n)) return 1;
    long long int c = 0;
    while (n % 2 == 0) {
      c++;
      n = n / 2;
    }
    for (long long int i = 3; i <= sqrt(n) + 1; i = i + 2) {
      while (n % i == 0) {
        c++;
        n = n / i;
      }
    }
    if (n > 2) {
      c++;
    }
    return c;
  }
  bool isp(string s) {
    for (long long int i = 0; i < (s.size() / 2); i++) {
      if (s[i] != s[s.size() - 1 - i]) return false;
    }
    return true;
  }
  long long int len(long long int n) {
    long long int ans = 0;
    while (n != 0) {
      n = n / 10;
      ans++;
    }
    return ans;
  }
  long long int binarySearch(long long int p, long long int r, long long int n) {
    if (p <= r) {
      long long int mid = (p + r) / 2;
      if (mid == n) {
        return mid;
      } else if (mid > n)
        return binarySearch(p, mid - 1, n);
      else if (mid < n)
        return binarySearch(mid + 1, r, n);
    }
    return -1;
  }
  void divisors_till_n(int n) {
    long long int divisors[100000];
    for (int i = 1; i <= n; i++) {
      for (int j = i; j <= n; j += i) {
        divisors[j]++;
        divisors[j] %= 998244353;
      }
    }
  }
  long long int countFreq(string &pat, string &txt) {
    long long int M = pat.length();
    long long int N = txt.length();
    long long int res = 0;
    for (int i = 0; i <= N - M; i++) {
      int j;
      for (j = 0; j < M; j++)
        if (txt[i + j] != pat[j]) break;
      if (j == M) {
        res++;
        j = 0;
      }
    }
    return res;
  }
  vector<int> z_function(string s) {
    int n = (int)s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
      if (i <= r) z[i] = min(r - i + 1, z[i - l]);
      while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
      if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
    }
    return z;
  }
  bool sortbysecdesc(const pair<long long int, long long int> &a,
                     const pair<long long int, long long int> &b) {
    return a.second < b.second;
  }
  long long int close(long long int n, long long int a, long long int b) {
    long long int div = n / b;
    long long int no = n / a;
    while ((n - (div)*b) % a != 0 && div >= (n - (a * no))) div--;
    if (div >= 0) return div;
    return -1;
  }
  long long int op(long long int num1, long long int num2) {
    long long int ans = 0;
    long long int p = 0;
    while (num1 != 0) {
      long long int bin1, bin2;
      bin1 = num1 % 2;
      bin2 = num2 % 2;
      if (bin1 == 1 && bin2 == 0) {
        ans += pow(2, p);
      }
      p++;
      num1 = num1 / 2;
      num2 = num2 / 2;
    }
    return ans;
  }
  long long int func(long long int n) {
    long long int p = 0, ans = 0;
    while (n != 0) {
      long long int num = n % 10;
      if (num >= 1) {
        ans += pow(10, p);
      }
      p++;
      n = n / 10;
    }
    return ans;
  }
  struct cust {
    double val;
    long long int ii;
    long long int jj;
  };
  bool operator<(const cust &c1, const cust &c2) { return c1.val < c2.val; }
  string r(string a) {
    reverse(a.begin(), a.end());
    return a;
  }
  long long int solve(string n, vector<long long int> p) {
    long long int ans = 1e10;
    for (long long int i = 0; i < p.size(); i++) {
      long long int f = 0;
      string s = to_string(p[i]);
      long long int j = 0;
      for (long long int k = 0; k < n.size() && j < s.size(); k++) {
        if (s[j] == n[k]) {
          j++;
        }
      }
      long long int moves = (n.size() - j) + (s.size() - j);
      ans = min(moves, ans);
    }
    return ans;
  }
  long long int voting_algo(vector<vector<long long int>> arr, long long int n) {
    long long int count1 = 0, count2 = 0;
    long long int first = 0, second = 1;
    for (long long int j = 0; j < arr[0].size(); j++) {
      for (long long int i = 0; i < n; i++) {
        if (arr[first][j] >= arr[i][j] && count1 != 0)
          count1++;
        else if (arr[second][j] >= arr[i][j] && count2 != 0)
          count2++;
        else if (count1 == 0) {
          count1++;
          first = i + 1;
        } else if (count2 == 0) {
          count2++;
          second = i + 1;
        } else {
          count1--;
          count2--;
        }
      }
    }
    count1 = 0;
    count2 = 0;
    for (long long int j = 0; j < arr[0].size(); j++) {
      for (long long int i = 0; i < n; i++) {
        if (arr[first][j] >= arr[i][j])
          count1++;
        else if (arr[second][j] >= arr[i][j])
          count2++;
      }
    }
    if (count1 > n / 3) return first;
    if (count2 > n / 3) return second;
    return -1;
  }
  int main() {
    long long int t;
    cin >> t;
    while (t--) {
      long long int a, b;
      cin >> a >> b;
      set<long long int> br;
      long long int games = a + b;
      long long int mwa, mwb;
      long long int minb;
      if (games % 2 == 0) {
        mwa = games / 2;
        mwb = games / 2;
        if (a >= b) {
          minb = a - mwa;
          mwb = mwb - minb;
          mwa = a;
          for (long long int i = 0; i < mwb + 1; i++) {
            br.insert(minb + 2 * i);
          }
        } else {
          minb = b - mwb;
          mwa = mwa - minb;
          mwb = b;
          for (long long int i = 0; i < mwa + 1; i++) {
            br.insert(minb + 2 * i);
          }
        }
      } else {
        mwa = games / 2 + 1;
        mwb = games / 2;
        if (a >= b) {
          minb = a - mwa;
          mwb = mwb - minb;
          mwa = a;
          for (long long int i = 0; i < mwb + 1; i++) {
            br.insert(minb + 2 * i);
          }
        } else {
          minb = b - mwb;
          mwa = mwa - minb;
          mwb = b;
          for (long long int i = 0; i < mwa + 1; i++) {
            br.insert(minb + 2 * i);
          }
        }
        mwa = games / 2;
        mwb = games / 2 + 1;
        if (a >= b) {
          minb = a - mwa;
          mwb = mwb - minb;
          mwa = a;
          for (long long int i = 0; i < mwb + 1; i++) {
            br.insert(minb + 2 * i);
          }
        } else {
          minb = b - mwb;
          mwa = mwa - minb;
          mwb = b;
          for (long long int i = 0; i < mwa + 1; i++) {
            br.insert(minb + 2 * i);
          }
        }
      }
      cout << br.size() << endl;
      for (auto it = br.begin(); it != br.end(); it++) cout << *it << " ";
      cout << endl;
    }
  }
  