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 codechef;
  
  import java.io.DataInputStream;
  import java.io.FileInputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.PrintWriter;
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.Comparator;
  
  
  public class cp_2 {
  	static int mod=(int)1e9+7;
  	
  //	static  Reader sc=new Reader();
  	   static FastReader sc=new FastReader(System.in);
  	   
  
  	
  	public static void main(String[] args) throws IOException {
  		// TODO Auto-generated method stub
  		//FastReader sc=new FastReader();
  			
  			int t=sc.nextInt();
  			while(t-->0)
  			{
  				
  				int a=sc.nextInt(),b=sc.nextInt(),n=a+b;
  				int arr[]=new int[n],A=a,B=b;
  				
  				
  				int Asame=0,Bsame=0;
  				int diff=0;
  				ArrayList<Integer> k=new ArrayList<Integer>();
  				for(int i=0;i<n;i++)
  				{
  					if((i&1)==0)
  					{//alice
  						if(A!=0)
  						{
  							arr[i]=0;
  							A--;
  						}
  						else
  						{
  							arr[i]=1;
  							B--;
  						}
  					}
  					else
  					{
  						if(B!=0)
  						{
  							arr[i]=1;
  							B--;
  						}
  						else
  						{
  							arr[i]=0;
  							A--;
  						}
  					}
  					if(arr[i]==0)
  					{
  						if((i&1)==0)
  						Asame++;
  						else
  						diff++;
  					}
  					else
  					{
  						if((i&1)==1)
  						Bsame++;
  						else
  						diff++;
  					}
  				}
  
  
  				k.add(diff);
  				int min=Math.min(Asame, Bsame);
  				while(min-->0)
  				{
  					diff+=2;
  					k.add(diff);
  				}
  				if((a+b)%2==0)
  				{
  					out.println(k.size());
  					for(int v: k)
  					out.print(v+" ");
  					out.println();
  					continue;
  				}
  				Asame=0;
  				Bsame=0;
  				diff=0;
  				A=a;
  				B=b;
  				for(int i=0;i<n;i++)
  				{
  					if(((i+1)&1)==0)
  					{//alice
  						if(A!=0)
  						{
  							arr[i]=0;
  							A--;
  						}
  						else
  						{
  							arr[i]=1;
  							B--;
  						}
  					}
  					else
  					{
  						if(B!=0)
  						{
  							arr[i]=1;
  							B--;
  						}
  						else
  						{
  							arr[i]=0;
  							A--;
  						}
  					}
  					if(arr[i]==0)
  					{
  						if(((i+1)&1)==0)
  						Asame++;
  						else
  						diff++;
  					}
  					else
  					{
  						if(((i+1)&1)==1)
  							Bsame++;
  						else
  							diff++;
  					}
  				}
  				
  				
  				min=Math.min(Asame, Bsame);
  				k.add(diff);
  				while(min-->0)
  				{
  					diff+=2;
  					k.add(diff);
  				}
  				Collections.sort(k);
  				
  				out.println(k.size());
  				
  				
  				for(int v: k)
  				out.print(v+" ");
  				out.println();
  			
  			}
  				
  			out.flush();
  			out.close();
  			System.gc();
  	
  	}
  	
  	
  	
  
  
  	/*
  	   ...SOLUTION ENDS HERE...........SOLUTION ENDS HERE...
  	 */
  	 
  	
  	
  	static boolean util(int a,int b,int c)
  	{
  		if(b>a)util(b, a, c);
  		
  		while(c>=a)
  		{
  			c-=a;
  			if(c%b==0)
  				return true;
  		}
  		
  		
  		return (c%b==0);
  	}
  	
  	static boolean check(int arr[])
  	{
  		for (int i = 1; i < arr.length; i++) {
  		if(arr[i-1]>arr[i])
  			return false;
  		}
  		return true;
  	}
  	
  	static void flag(boolean flag)
  	   {
  	       out.println(flag ? "YES" : "NO");
  	       out.flush();
  	   }
  	   
  	static ArrayList<Long> luckNums;
  	static void luckyNum(long x,long p10)
  	{
  		luckNums.add(x);
  		if(x>(long)1e10)
  			return;
  		luckyNum(x+4*p10, p10*10);
  		luckyNum(x+7*p10, p10*10);
  		
  	}
  	
  	 /*                     
  	    Map<Long,Long> map=new HashMap<>();
  	             for(int i=0;i<n;i++)
  	               {
  	                  if(!map.containsKey(a[i]))
  	                   map.put(a[i],1);
  	                 else
  	                   map.replace(a[i],map.get(a[i])+1);
  	               }
  	     
  	    Set<Map.Entry<Long,Long>> hmap=map.entrySet();
  	             for(Map.Entry<Long,Long> data : hmap)
  	               {
  	          
  	               }
  	       
  	   Iterator<Integer> it = set.iterator();
  	          while(it.hasNext()) 
  	           { 
  	            int x=it.next();
  	           }
  	   */
  
  	
  	
  	static void print(int a[])
  	  {
  	     int n=a.length;
  	     for(int i=0;i<n;i++)
  	       {
  	          out.print(a[i]+" ");
  	       }
  	     out.println();
  	     out.flush();
  	  }
  	static void print(long a[])
  	  {
  	     int n=a.length;
  	     for(int i=0;i<n;i++)
  	       {
  	          out.print(a[i]+" ");
  	       }
  	     out.println();
  	     out.flush();
  	  } 
  	static void print_int(ArrayList<Integer> al)
  	  {
  	     int si=al.size();
  	     for(int i=0;i<si;i++)
  	       {
  	          out.print(al.get(i)+" ");
  	       }
  	     out.println();
  	     out.flush();
  	  }
  	static void print_long(ArrayList<Long> al)
  	  {
  	     int si=al.size();
  	     for(int i=0;i<si;i++)
  	       {
  	          out.print(al.get(i)+" ");
  	       }
  	     out.println();
  	     out.flush();
  	  }
  	  
  	static int LowerBound(int a[], int x) 
  	 { // x is the target value or key
  	  int l=-1,r=a.length;
  	  while(l+1<r) {
  	    int m=(l+r)>>>1;
  	    if(a[m]>=x) r=m;
  	    else l=m;
  	  }
  	  return r;
  	}
  	
  	
  	static int lowerIndex(int arr[], int n, int x)
      {
          int l = 0, h = n - 1;
          while (l <= h)
          {
              int mid = (l + h) / 2;
              if (arr[mid] >= x)
                  h = mid - 1;
              else
                  l = mid + 1;
          }
          return l;
      }
       
  	
  	 static int UpperBound(int a[], int x)
  	  {// x is the key or target value
  	    int l=-1,r=a.length;
  	    while(l+1<r) {
  	       int m=(l+r)>>>1;
  	       if(a[m]<=x) l=m;
  	       else r=m;
  	    }
  	    return l+1;
  	 }
  	 static class DisjointUnionSets
  	 {
  	    int[] rank, parent;
  	    int n;
  	    // Constructor
  	    public DisjointUnionSets(int n)
  	    {
  	        rank = new int[n];
  	        parent = new int[n];
  	        this.n = n;
  	        makeSet();
  	    }
  	    // Creates n sets with single item in each
  	    void makeSet()
  	    {
  	        for (int i = 0; i < n; i++)
  	            parent[i] = i;
  	    }
  	    int find(int x)
  	    {
  	        if (parent[x] != x) {
  	            parent[x] = find(parent[x]);
  	        }
  	        return parent[x];
  	    }
  	    // Unites the set that includes x and the set
  	    // that includes x
  	    void union(int x, int y)
  	    {
  	        int xRoot = find(x), yRoot = find(y);
  	        if (xRoot == yRoot)
  	            return;
  	        if (rank[xRoot] < rank[yRoot])
  	            parent[xRoot] = yRoot;
  	        else if (rank[yRoot] < rank[xRoot])
  	         parent[yRoot] = xRoot;
  	        else // if ranks are the same
  	        {
  	         parent[yRoot] = xRoot;
  	            rank[xRoot] = rank[xRoot] + 1;
  	        }
  	    }
  	 }
  
  	 
  //	static class countClass{
  //		int cnt;
  //		public countClass() {
  //			this.cnt=0;
  //			// TODO Auto-generated constructor stub
  //		}
  //	}
  
  	 
  	 
  	static class Graph
  	  {
  	        int v;
  	        ArrayList<Integer> list[];
  	        Graph(int v)
  	        {
  	            this.v=v;
  	            list=new ArrayList[v+1];
  	            for(int i=1;i<=v;i++)
  	                list[i]=new ArrayList<Integer>();
  	        }
  	        void addEdge(int a, int b)
  	        {
  	            this.list[a].add(b);
  	        }
  	    }
  	
  //	static class GraphMap{
  //		Map<String,ArrayList<String>> graph;
  //		GraphMap() {
  //			// TODO Auto-generated constructor stub
  //			graph=new HashMap<String,ArrayList<String>>();
  //			
  //		}
  //		void addEdge(String a,String b)
  //		{
  //			if(graph.containsKey(a))
  //			this.graph.get(a).add(b);
  //			else {
  //				this.graph.put(a, new ArrayList<>());
  //				this.graph.get(a).add(b);
  //			}
  //		}
  //	}
  //	static void dfsMap(GraphMap g,HashSet<String> vis,String src,int ok)
  //	{
  //		vis.add(src);
  //		
  //		if(g.graph.get(src)!=null)
  //		{
  //			for(String each:g.graph.get(src))
  //			{
  //				if(!vis.contains(each))
  //				{
  //					dfsMap(g, vis, each, ok+1);
  //				}
  //			}
  //		}
  //		
  //		cnt=Math.max(cnt, ok);
  //	}
  	static double sum[];
  	static double cnt;
  	static void DFS(Graph g, boolean[] visited, int u,double path)
  		{
  	        visited[u]=true;
  	        sum[u]=0;
  	        int k=0;
  	        for(int i=0;i<g.list[u].size();i++)
  	        {
  	            int v=g.list[u].get(i);
  	            
  	            if(!visited[v])
  	            {
  	            	DFS(g, visited, v,path+1);
  	            	sum[u]+=sum[v];
  	            	k++;
  	            }
  	            
  	        }
  	        if(k!=0)
  	        sum[u]=sum[u]/(double)k +1;
  
  	  } 
  	
  	
  	  
  	 static class Pair
  	    {
  	       int x,y;
  	       Pair(int x,int y)
  	        {
  	           this.x=x;
  	           this.y=y;
  	        }
  	    }
  	   
  	static long sum_array(int a[])
  	 {
  	    int n=a.length;
  	    long sum=0;
  	    for(int i=0;i<n;i++)
  	     sum+=a[i];
  	    return sum;
  	 }
  	static long sum_array(long a[])
  	 {
  	    int n=a.length;
  	    long sum=0;
  	    for(int i=0;i<n;i++)
  	     sum+=a[i];
  	    return sum;
  	 }
  
  	 static void sort(int[] a) 
  	   {
  			ArrayList<Integer> l=new ArrayList<>();
  			for (int i:a) l.add(i);
  			Collections.sort(l);
  			for (int i=0; i<a.length; i++) a[i]=l.get(i);
  		}
  	static void sort(long[] a) 
  	   {
  			ArrayList<Long> l=new ArrayList<>();
  			for (long i:a) l.add(i);
  			Collections.sort(l);
  			for (int i=0; i<a.length; i++) a[i]=l.get(i);
  		}
  
  	static void reverse_array(int a[])
  	 {
  	    int n=a.length;
  	    int i,t; 
  	    for (i = 0; i < n / 2; i++) { 
  	            t = a[i]; 
  	            a[i] = a[n - i - 1]; 
  	            a[n - i - 1] = t; 
  	        } 
  	 }
  	static void reverse_array(long a[])
  	 {
  	    int n=a.length;
  	    int i; long t; 
  	    for (i = 0; i < n / 2; i++) { 
  	            t = a[i]; 
  	            a[i] = a[n - i - 1]; 
  	            a[n - i - 1] = t; 
  	        } 
  	 }
  	 static long modInverse(long a, long m)
  		    {
  		        long g = gcd(a, m);
  		       
  		          return   power(a, m - 2, m);
  		        
  		    }
  	static long power(long x, long y, long m)
  		    {
  		        if (y == 0)
  		            return 1;
  		        long p = power(x, y / 2, m) % m;
  		        p = (int)((p * (long)p) % m);
  		        if (y % 2 == 0)
  		            return p;
  		        else
  		            return (int)((x * (long)p) % m);
  		    }
  	static long gcd(long a, long b) 
  	    { 
  	        if (a == 0) 
  	            return b; 
  	          
  	        return gcd(b%a, a); 
  	    } 
  	static int gcd(int a, int b) 
  	    { 
  	        if (a == 0) 
  	            return b; 
  	          
  	        return gcd(b%a, a); 
  	    } 
  
  	   static class FastReader{
  	 
  	        byte[] buf = new byte[2048];
  	        int index, total;
  	        InputStream in;
  	 
  	        FastReader(InputStream is) {
  	            in = is;
  	        }
  	 
  	        int scan() throws IOException {
  	            if (index >= total) {
  	                index = 0;
  	                total = in.read(buf);
  	                if (total <= 0) {
  	                    return -1;
  	                }
  	            }
  	            return buf[index++];
  	        }
  	 
  	        String next() throws IOException {
  	            int c;
  	            for (c = scan(); c <= 32; c = scan());
  	            StringBuilder sb = new StringBuilder();
  	            for (; c > 32; c = scan()) {
  	                sb.append((char) c);
  	            }
  	            return sb.toString();
  	        }
  	 
  	        int nextInt() throws IOException {
  	            int c, val = 0;
  	            for (c = scan(); c <= 32; c = scan());
  	            boolean neg = c == '-';
  	            if (c == '-' || c == '+') {
  	                c = scan();
  	            }
  	            for (; c >= '0' && c <= '9'; c = scan()) {
  	                val = (val << 3) + (val << 1) + (c & 15);
  	            }
  	            return neg ? -val : val;
  	        }
  	 
  	        long nextLong() throws IOException {
  	            int c;
  	            long val = 0;
  	            for (c = scan(); c <= 32; c = scan());
  	            boolean neg = c == '-';
  	            if (c == '-' || c == '+') {
  	                c = scan();
  	            }
  	            for (; c >= '0' && c <= '9'; c = scan()) {
  	                val = (val << 3) + (val << 1) + (c & 15);
  	            }
  	            return neg ? -val : val;
  	        }
  	    }
  	   
  	    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(); 
  	        } 
  	    }
  	  static  PrintWriter out=new PrintWriter(System.out);
  	  static int int_max=Integer.MAX_VALUE;
  	  static int int_min=Integer.MIN_VALUE;
  	  static long long_max=Long.MAX_VALUE;
  	  static long long_min=Long.MIN_VALUE;
  
  }
  
  
  
  
  