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 MyJava;
  
  import java.io.DataInputStream;
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.IOException;
  import java.io.PrintStream;
  import java.io.PrintWriter;
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.Comparator;
  import java.util.HashMap;
  import java.util.HashSet;
  import static java.lang.Math.min;
  import static java.lang.Math.max;
  import static java.lang.Math.abs;
  
  public class Main {
  	static boolean DEBUG = false;
  
  	public static void main(String[] args) throws IOException {
  		Comparator<pair> com = (p1,
  				p2) -> ((p1.first > p2.first || (p1.first == p2.first && p1.second > p2.second)) ? 1 : -1);
  		if (System.getProperty("ONLINE_JUDGE") == null) {
  			System.setIn(new FileInputStream(new File("D://program//javaCPEclipse//MyJava//src//MyJava//input.txt")));
  			//            System.setOut(new PrintStream(new File("output.txt")));
  			System.setErr(new PrintStream(new File("D://program//javaCPEclipse//MyJava//src//MyJava//error.txt")));
  			DEBUG = true;
  		}
  		Reader fs = new Reader();
  		PrintWriter pw = new PrintWriter(System.out, true);
  		int t = fs.nextInt();
  		while (t-- > 0) {
  			int a = fs.nextInt(), b = fs.nextInt();
  			int n = a+b;
  			int d = abs(a - b)/2;
  			if(a == 0 & b == 0) {
  				pw.println(0);continue;
  			}
  			ArrayList<Integer>ans = new ArrayList<Integer>();
  			if( n % 2 == 0) {
  				for(int i = d ; i <= n - d ; i+=2) {
  					ans.add(i);
  				}
  			}else {
  				for(int i = d ; i <= n - d ; i+=1) {
  					ans.add(i);
  				}
  			}
  			Collections.sort(ans);
  			pw.println(ans.size());
  			for(Integer x : ans) {
  				pw.print(x + " ");
  			}
  			pw.println();
  		}
  		fs.close();
  		pw.close();
  
  	}
  
  	static <T> void debug(HashSet<Integer> a, String l) {
  		if (DEBUG) {
  			System.err.println(l + " -> ");
  			System.err.println(a);
  		}
  	}
  
  	static void debug(String a, String l) {
  		if (DEBUG) {
  			System.err.println(l + " -> " + a);
  		}
  	}
  
  	static void debug(StringBuilder a, String l) {
  		if (DEBUG) {
  			System.err.println(l + " -> " + a);
  		}
  	}
  
  	static <T extends Number, V extends T> void debug(HashMap<T, V> a, String l) {
  		if (DEBUG) {
  			System.err.println(l + " -> ");
  			System.err.println(a);
  		}
  	}
  
  	static <T extends Number> void debug(T a, String l) {
  		if (DEBUG) {
  			System.err.println(l + " -> " + a);
  		}
  	}
  
  	static <T extends Number> void debug(T[] a, String l) {
  		if (DEBUG) {
  			System.err.print(l + " -> \n" + "[ ");
  			for (int i = 0; i < a.length; i++) {
  				System.err.print(a[i] + " ");
  			}
  			System.err.println("]");
  		}
  	}
  
  	static <T> void debug(ArrayList<T> a, String l) {
  		if (DEBUG) {
  			System.err.print(l + " -> ");
  			System.err.print("[ ");
  			for (T q : a) {
  				System.err.print(q + " ");
  			}
  			System.err.println("]");
  		}
  	}
  
  	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 next() throws IOException {
  			byte[] buf = new byte[100009];
  			int cnt = 0, c;
  			while ((c = read()) != -1) {
  				if (c <= ' ') {
  					if (cnt != 0) {
  						break;
  					} else {
  						continue;
  					}
  				}
  				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 int[] readArray(int n) throws IOException {
  			int[] arr = new int[n];
  			for (int i = 0; i < n; i++) {
  				arr[i] = nextInt();
  			}
  			return arr;
  		}
  
  		public int[] readArray(int n, int x) throws IOException {
  			int[] arr = new int[n + x];
  			for (int i = x; i < n + x; i++) {
  				arr[i] = nextInt();
  			}
  			return arr;
  		}
  
  		public ArrayList<Integer> readList(int n) throws IOException {
  			ArrayList<Integer> a = new ArrayList<Integer>();
  			for (int i = 0; i < n; i++) {
  				a.add(nextInt());
  			}
  			return a;
  		}
  
  		public int[][] read2Array(int n, int m) throws IOException {
  			int[][] a = new int[n][m];
  			for (int i = 0; i < n; i++) {
  				for (int j = 0; j < m; j++) {
  					a[i][j] = nextInt();
  				}
  			}
  
  			return a;
  		}
  
  		public void close() throws IOException {
  			if (din == null)
  				return;
  			din.close();
  		}
  	}
  
  	public static int pow(int base, int index) {
  		if (index == 0) {
  			return 1;
  		} else if (index % 2 == 0) {
  			return pow(base * base, index / 2);
  		} else {
  			return base * pow(base * base, ((index - 1) / 2));
  		}
  	}
  
  	public static long pow(long base, long index) {
  		if (index == 0) {
  			return 1;
  		} else if (index % 2 == 0) {
  			return pow(base * base, index / 2);
  		} else {
  			return base * pow(base * base, ((index - 1) / 2));
  		}
  	}
  
  	static class pair {
  		int first;
  		int second;
  
  		pair() {
  			this.first = 0;
  			this.second = 0;
  		}
  
  		pair(int first, int second) {
  			this.first = first;
  			this.second = second;
  		}
  
  		void make_pair(int first, int second) {
  			this.first = first;
  			this.second = second;
  		}
  	}
  }