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.net.StandardSocketOptions;
  
  public class tr0 {
  	static PrintWriter out;
  	static StringBuilder sb;
  	static long mod = (long) 1e9 + 7;
  	static long inf = (long) 1e16;
  	static int n, k;
  	static ArrayList<Integer>[] ad;
  	static int[][] remove, add;
  	static int[][] memo;
  	static boolean vis[];
  	static long[] inv, ncr[];
  	static HashMap<Integer, Integer> hm;
  	static int[] pre, suf, Smax[], Smin[];
  	static int idmax, idmin;
  	static ArrayList<Integer> av;
  	static HashMap<Integer, Integer> mm;
  	static boolean[] msks;
  	static int[] lazy[], lazyCount;
  	static int[] dist;
  	static int[][] P;
  	static long N;
  	static ArrayList<Integer> gl;
  	static int[] a;
  	static String s;
  
  	public static void main(String[] args) throws Exception {
  		Scanner sc = new Scanner(System.in);
  		out = new PrintWriter(System.out);
  		int t = sc.nextInt();
  		while (t-- > 0) {
  			Queue<Integer> q = new LinkedList<Integer>();
  			int a = sc.nextInt();
  			int b = sc.nextInt();
  			int turns = a + b;
  			for (int k = 0; k <= turns; k++) {
  				int at = (turns + 1) / 2;
  				int bt = turns / 2;
  				boolean f = false;
  				if (at == a) {
  					if (k % 2 == 0 && (at + 0)  >= k / 2 && (bt + 0)  >= k / 2)
  						f = true;
  				} else if (at < a) {
  					int k1 = k;
  					k1 -= a - at;
  					bt -= a - at;
  					if (k1 >= 0 && bt>=0) {
  						if (k1 % 2 == 0 && (at + 0)  >= k1 / 2 && (bt + 0)  >= k1 / 2)
  							f = true;
  					}
  				} else {
  					int k1 = k;
  					k1 -= b - bt;
  					at -= b - bt;
  					if (k1 >= 0 && at>=0) {
  						if (k1 % 2 == 0 && (at )  >= k1 / 2 && (bt )  >= k1 / 2)
  							f = true;
  					}
  				}
  				//System.out.println(f+" "+k);
  				at = turns / 2;
  				bt = (turns + 1) / 2;
  
  				if (at == a) {
  					if (k % 2 == 0 && (at + 0)  >= k / 2 && (bt + 0) >= k / 2)
  						f = true;
  				} else if (at < a) {
  					int k1 = k;
  					k1 -= a - at;
  					bt -= a - at;
  					if (k1 >= 0) {
  						if (k1 % 2 == 0 && (at + 0)  >= k1 / 2 && (bt + 0)  >= k1 / 2)
  							f = true;
  					}
  				} else {
  					int k1 = k;
  					k1 -= b - bt;
  					at -= b - bt;
  					if (k1 >= 0) {
  						if (k1 % 2 == 0 && (at + 0)  >= k1 / 2 && (bt + 0)  >= k1 / 2)
  							f = true;
  					}
  				}
  				if (f)
  					q.add(k);
  			}
  			out.println(q.size());
  			for (int h : q)
  				out.print(h + " ");
  			out.println();
  		}
  		out.flush();
  	}
  
  	static class Scanner {
  		StringTokenizer st;
  		BufferedReader br;
  
  		public Scanner(InputStream system) {
  			br = new BufferedReader(new InputStreamReader(system));
  		}
  
  		public Scanner(String file) throws Exception {
  			br = new BufferedReader(new FileReader(file));
  		}
  
  		public String next() throws IOException {
  			while (st == null || !st.hasMoreTokens())
  				st = new StringTokenizer(br.readLine());
  			return st.nextToken();
  		}
  
  		public String nextLine() throws IOException {
  			return br.readLine();
  		}
  
  		public int nextInt() throws IOException {
  			return Integer.parseInt(next());
  		}
  
  		public double nextDouble() throws IOException {
  			return Double.parseDouble(next());
  		}
  
  		public char nextChar() throws IOException {
  			return next().charAt(0);
  		}
  
  		public Long nextLong() throws IOException {
  			return Long.parseLong(next());
  		}
  
  		public int[] nextArrInt(int n) throws IOException {
  			int[] a = new int[n];
  			for (int i = 0; i < n; i++)
  				a[i] = nextInt();
  			return a;
  		}
  
  		public long[] nextArrLong(int n) throws IOException {
  			long[] a = new long[n];
  			for (int i = 0; i < n; i++)
  				a[i] = nextLong();
  			return a;
  		}
  
  		public int[] nextArrIntSorted(int n) throws IOException {
  			int[] a = new int[n];
  			Integer[] a1 = new Integer[n];
  			for (int i = 0; i < n; i++)
  				a1[i] = nextInt();
  			Arrays.sort(a1);
  			for (int i = 0; i < n; i++)
  				a[i] = a1[i].intValue();
  			return a;
  		}
  
  		public long[] nextArrLongSorted(int n) throws IOException {
  			long[] a = new long[n];
  			Long[] a1 = new Long[n];
  			for (int i = 0; i < n; i++)
  				a1[i] = nextLong();
  			Arrays.sort(a1);
  			for (int i = 0; i < n; i++)
  				a[i] = a1[i].longValue();
  			return a;
  		}
  
  		public boolean ready() throws IOException {
  			return br.ready();
  		}
  
  		public void waitForInput() throws InterruptedException {
  			Thread.sleep(3000);
  		}
  	}
  }