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.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.math.BigInteger;
  import java.util.*;
  
  public class Practice {
  	public static long mod = (long) Math.pow(10, 9) + 7;
  	public static long mod2 = 998244353;
  	public static int tt = 1;
  	public static ArrayList<Integer> prime;
  	public static long[] fac = new long[200005];
  	public static long[] invfac = new long[200005];
  
  	public static void main(String[] args) throws Exception {
  		PrintWriter pw = new PrintWriter(System.out);
  		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  		int t = Integer.parseInt(br.readLine());
  		while (t-- > 0) {
  			String[] s1 = br.readLine().split(" ");
  			int a = Integer.valueOf(s1[0]);
  			int b = Integer.valueOf(s1[1]);
  			if ((a + b) % 2 == 0) {
  				int x = (a + b) / 2;
  				int min = Math.min(a, b);
  				int max = Math.max(a, b);
  				int bb = max - x;
  				ArrayList<Integer> list = new ArrayList<Integer>();
  				StringBuilder str = new StringBuilder();
  				int cc = bb;
  				for (int i = bb; i <= x; i++) {
  					list.add(cc);
  					cc += 2;
  				}
  				pw.println(list.size());
  				for (int i = 0; i < list.size(); i++) {
  					str.append(list.get(i) + " ");
  				}
  				pw.println(str.toString());
  			} else {
  				ArrayList<Integer> list = new ArrayList<Integer>();
  				int x = (a + b) / 2;
  				int min = Math.min(a, b);
  				int max = Math.max(a, b);
  				int bb = max - x - 1;
  				StringBuilder str = new StringBuilder();
  				int cc = bb;
  				for (int i = bb; i <= x; i++) {
  					list.add(cc);
  					cc += 2;
  				}
  				bb = max - x;
  				cc = bb;
  				for (int i = bb; i <= x + 1; i++) {
  					list.add(cc);
  					cc += 2;
  				}
  				Collections.sort(list);
  				pw.println(list.size());
  				for (int i = 0; i < list.size(); i++) {
  					str.append(list.get(i) + " ");
  				}
  				pw.println(str.toString());
  			}
  		}
  		pw.close();
  	}
  
  //
  //	private static long power(long a, long p) {
  //		// TODO Auto-generated method stub
  //		long res = 1;
  //		while (p > 0) {
  //			if (p % 2 == 1) {
  //				res = (res * a) % mod;
  //			}
  //			p = p / 2;
  //			a = (a * a) % mod;
  //		}
  //		return res;
  //	}
  
  	// private static int kmp(String str) {
  //		// TODO Auto-generated method stub
  //		// System.out.println(str);
  //		int[] pi = new int[str.length()];
  //		pi[0] = 0;
  //		for (int i = 1; i < str.length(); i++) {
  //			int j = pi[i - 1];
  //			while (j > 0 && str.charAt(i) != str.charAt(j)) {
  //				j = pi[j - 1];
  //			}
  //			if (str.charAt(j) == str.charAt(i)) {
  //				j++;
  //			}
  //			pi[i] = j;
  //			System.out.print(pi[i]);
  //		}
  //		System.out.println();
  //		return pi[str.length() - 1];
  //	}
  
  }
  
  //	private static void getFac(long n, PrintWriter pw) {
  //		// TODO Auto-generated method stub
  //		int a = 0;
  //		while (n % 2 == 0) {
  //			a++;
  //			n = n / 2;
  //		}
  //		if (n == 1) {
  //			a--;
  //		}
  //		for (int i = 3; i <= Math.sqrt(n); i += 2) {
  //			while (n % i == 0) {
  //				n = n / i;
  //				a++;
  //			}
  //		}
  //		if (n > 1) {
  //			a++;
  //		}
  //		if (a % 2 == 0) {
  //			pw.println("Bob");
  //		} else {
  //			pw.println("Alice");
  //		}
  //		//System.out.println(a);
  //		return;
  //	}
  
  //	private static long power(long a, long p) {
  //		// TODO Auto-generated method stub
  //		long res = 1;
  //		while (p > 0) {
  //			if (p % 2 == 1) {
  //				res = (res * a) % mod;
  //			}
  //			p = p / 2;
  //			a = (a * a) % mod;
  //		}
  //		return res;
  //	}
  //
  //	private static void fac() {
  //		fac[0] = 1;
  //		// TODO Auto-generated method stub
  //		for (int i = 1; i < fac.length; i++) {
  //			if (i == 1) {
  //				fac[i] = 1;
  //			} else {
  //				fac[i] = i * fac[i - 1];
  //			}
  //			if (fac[i] > mod) {
  //				fac[i] = fac[i] % mod;
  //			}
  //		}
  //	}
  //
  //	private static int getLower(Long long1, Long[] st) {
  //		// TODO Auto-generated method stub
  //		int left = 0, right = st.length - 1;
  //		int ans = -1;
  //		while (left <= right) {
  //			int mid = (left + right) / 2;
  //			if (st[mid] <= long1) {
  //				ans = mid;
  //				left = mid + 1;
  //			} else {
  //				right = mid - 1;
  //			}
  //		}
  //		return ans;
  //	}
  
  //private static long getGCD(long l, long m) {
  //
  //	long t1 = Math.min(l, m);
  //	long t2 = Math.max(l, m);
  //	if (t1 == 0) {
  //		return t2;
  //	}
  //	while (true) {
  //		long temp = t2 % t1;
  //		if (temp == 0) {
  //			return t1;
  //		}
  //		t2 = t1;
  //		t1 = temp;
  //	}
  //}