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 \le t \le 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 \le a, b \le 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 \cdot 10^5$.


-----Output-----

For each test case print two lines.

In the first line, print a single integer $m$ ($1 \le m \le 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, \ldots, k_m$ ($0 \le k_1 < k_2 < \ldots < k_m \le a + b$) — the sought values of $k$ in increasing order.


-----Examples-----

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.

Difficulty: EASY

Solutions:
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = abs(a - b) // 2
	r = a + b - l
	j = 1
	if (a + b) % 2 == 0:
		j = 2
	a = list(range(l, r + 1, j))
	print(len(a))
	print(' '.join(map(str, a)))


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp_vars_int = lambda : map(int, input().split())
inp_list_int = lambda : list(map(int, input().split()))
t = int(input())
for _ in range(t):
	(a, b) = inp_vars_int()
	diff = abs(a - b)
	tot = a + b
	eg = tot % 2
	min_br = diff // 2
	max_br = 2 * min(a, b) + diff // 2 + eg
	opts = range(min_br, max_br + 1, 2 - eg)
	print(len(opts))
	print(' '.join(map(str, opts)))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	n = a + b
	if n % 2 == 0:
		m = n // 2
		x = m - a
		y = n - x
		z = (y - x) // 2 + 1
		print(z)
		print(' '.join(map(str, range(x, y + 1, 2))))
	else:
		m = n // 2
		x = m - a
		y = n - x
		z = y - x + 1
		print(z)
		print(' '.join(map(str, range(x, y + 1))))


def print_breaks(a, b):
	(a, b) = (min(a, b), max(a, b))
	x = b - a
	if x % 2 == 1:
		y = (x - 1) // 2
		res = list([str(el) for el in range(y, a * 2 + y + 2)])
	else:
		y = x // 2
		res = list([str(el) for el in range(y, 2 * a + y + 1, 2)])
	print(len(res))
	print(' '.join(res))
t = int(input())
for i in range(t):
	s = input()
	(a, b) = s.split(' ')
	(a, b) = (int(a), int(b))
	print_breaks(a, b)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	k = []
	m = abs(a - b) // 2
	M = a + b - m
	if (a + b) % 2:
		for i in range(m, M + 1):
			k.append(str(i))
	else:
		i = m
		while i <= M:
			k.append(str(i))
			i += 2
	print(len(k))
	print(' '.join(k))


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	k = []
	mi = abs(a - b) // 2
	ma = a + b - mi
	if (a + b) % 2:
		for i in range(mi, ma + 1):
			k.append(str(i))
	else:
		i = mi
		while i <= ma:
			k.append(str(i))
			i += 2
	print(len(k))
	print(' '.join(k))


def getlistint():
	return list(map(int, stdin.readline().split()))

def getmapint():
	return map(int, stdin.readline().split())

def getliststr():
	return list(stdin.readline().split())

def getint():
	return int(stdin.readline().strip())

def getstr():
	return stdin.readline().strip()

def pr(s):
	stdout.write(str(s) + '\n')

def prlist(l):
	stdout.write(' '.join(list(map(str, l))) + '\n')
from sys import stdin, stdout
for _ in range(getint()):
	(a, b) = getmapint()
	(a, b) = (min(a, b), max(a, b))
	k = []
	n = a + b
	if n % 2 == 0:
		step = 2
	else:
		step = 1
	starts = (b - a) // 2
	ends = n - starts
	for i in range(starts, ends + 1, step):
		k.append(i)
	pr(len(k))
	prlist(k)


def numberBreaks(a, b):
	(a, b) = (max(a, b), min(a, b))
	diff = a - b
	add_breaks = [diff // 2]
	breaks = []
	if diff % 2 == 1:
		add_breaks.append(add_breaks[0] + 1)
	for i in range(0, 2 * b + 1, 2):
		for a in add_breaks:
			breaks.append(i + a)
	breaks.sort()
	breaks = [str(a) for a in breaks]
	print(len(breaks))
	print(' '.join(breaks))
num_cases = int(input())
cases = []
for i in range(num_cases):
	case = input().split()
	cases.append(case)
for case in cases:
	numberBreaks(int(case[0]), int(case[1]))


t = int(input())
for tc in range(t):
	(a, b) = map(int, input().split())
	L = set()
	s = int((a + b) / 2)
	s2 = int((a + b + 1) / 2)
	for i in range(max(s2 - b, 0), min(a, s2) + 1):
		L.add(s2 - i + a - i)
		L.add(b - s2 + 2 * i)
	L = list(L)
	L.sort()
	print(len(L))
	print(' '.join(list(map(str, L))))


n = int(input().strip())
for _ in range(n):
	ab = input().strip().split(' ')
	(a, b) = (int(ab[0]), int(ab[1]))
	(a, b) = (min(a, b), max(a, b))
	total = a + b
	half = int(total / 2)
	res = []
	for i in range(a + 1):
		res.append(half + a - 2 * i)
		if total % 2 != 0:
			res.append(half + 1 + a - 2 * i)
	res = list(set(res))
	res.sort()
	reslist = [str(i) for i in res]
	print(len(res))
	print(' '.join(reslist))


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	d = []
	if min(a, b) % 2 == 1:
		c = [2 * k + 1 for k in range(-(min(a, b) + 1) // 2, (min(a, b) + 1) // 2)]
		for number in c:
			if (a + b) % 2 == 0:
				d.append((a + b) // 2 - number)
			else:
				d.append((a + b) // 2 - number)
				d.append(a + b - ((a + b) // 2 - number))
	else:
		c = [2 * k for k in range(-min(a, b) // 2, min(a, b) // 2 + 1)]
		for number in c:
			if (a + b) % 2 == 0:
				d.append((a + b) // 2 - number)
			else:
				d.append((a + b) // 2 - number)
				d.append(a + b - ((a + b) // 2 - number))
	e = sorted(list(set(d)))
	f = ' '.join(map(str, e))
	print(len(e))
	print(f)


tt = int(input())
for _ in range(tt):
	(c, d) = map(int, input().split())
	a = max(c, d)
	b = min(c, d)
	h = (a + b) // 2
	if (a + b) % 2 == 0:
		ans = list(range((a - b) // 2, h + b + 1, 2))
	else:
		ans = list(range((a - b) // 2, h + b + 2))
	print(len(ans))
	print(*ans)


import sys
import math
testcases = int(input())
while testcases > 0:
	(a, b) = map(int, sys.stdin.readline().split())
	s = a + b
	if s % 2 == 0:
		mini = max(a, b) - s // 2
		maxi = s // 2 + min(a, b)
		ans = [i for i in range(mini, maxi + 1, 2)]
	else:
		mini = max(a, b) - s // 2 - 1
		maxi = s // 2 + 1 + min(a, b)
		ans = [i for i in range(mini, maxi + 1)]
	print(len(ans))
	print(*ans)
	testcases -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	diff = abs(a - b) // 2
	sum = a + b
	if sum % 2 == 0:
		array = [i for i in range(diff, sum - diff + 1, 2)]
		print(len(array))
		print(*array)
	else:
		array = [i for i in range(diff, sum - diff + 1)]
		print(len(array))
		print(*array)


import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	s = a + b
	x = s // 2
	if s % 2 == 0:
		ans = [i for i in range(b - x, x + a + 1, 2)]
	else:
		ans = [i for i in range(b - x - 1, x + a + 2)]
	print(len(ans))
	print(*ans)
	t -= 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	l = abs(a - b) // 2
	r = a + b - l
	j = 1
	if (a + b) % 2 == 0:
		j = 2
	a = list(range(l, r + 1, j))
	print(len(a))
	print(*a)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	d = abs(n - m) // 2
	s = n + m
	if s % 2 == 0:
		ar = [i for i in range(d, s - d + 1, 2)]
		print(len(ar))
		print(*ar)
	else:
		ar = [i for i in range(d, s - d + 1)]
		print(len(ar))
		print(*ar)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	d = abs(a - b) // 2
	ans = []
	if (a + b) % 2:
		for i in range(d, a + b - d + 1):
			ans.append(i)
		print(len(ans))
		print(*ans)
	else:
		for i in range(d, a + b - d + 1, 2):
			ans.append(i)
		print(len(ans))
		print(*ans)
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	lst = []
	if a == b:
		i = 0
		while i <= a + b:
			lst.append(i)
			i += 2
	else:
		x = abs(a - b)
		if x % 2 == 0:
			y = x // 2
			while y < a + b - x // 2 + 1:
				lst.append(y)
				y += 2
		else:
			y = x // 2
			for i in range(y, a + b - y + 1):
				lst.append(i)
	print(len(lst))
	print(*lst)


t = int(input())
while t > 0:
	x = input().split()
	(a, b) = (int(x[0]), int(x[1]))
	n = a + b
	if n % 2 == 0:
		r = abs(a - b) // 2
		ans = (n - r) // 2
		c = []
		for i in range(r, n - r + 1, 2):
			c.append(i)
	else:
		r = (abs(a - b) - 1) // 2
		p = a + b + 1
		p = min(p, n - r + 1)
		c = []
		for i in range(r, p):
			c.append(i)
	print(len(c))
	print(*c, sep=' ')
	t -= 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	if (a + b) % 2:
		mi = (a + b) // 2 - min(a, b)
		ma = a + b - mi
		n = ma - mi + 1
		print(n)
		print(*list(range(mi, ma + 1)))
	else:
		mi = (a + b) // 2 - min(a, b)
		ma = a + b - mi
		n = (ma - mi) // 2 + 1
		print(n)
		print(*list(range(mi, ma + 1, 2)))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	n = a + b
	(x, y) = (n // 2, n // 2 + n % 2)
	k = min(a, x) + min(b, y)
	l = n - min(a, y) - min(b, x)
	s = list(range(min(l, k), max(l, k) + 2, 2))
	(x, y) = (n // 2 + n % 2, n // 2)
	k = min(a, x) + min(b, y)
	l = n - min(a, y) - min(b, x)
	s.extend(list(range(min(l, k), max(l, k) + 2, 2)))
	s = set(s)
	print(len(s))
	print(*sorted(s))


def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		n = a + b
		s = [x for x in range(n + 1)]
		ans = abs(a - b) // 2
		if n % 2:
			t = s[ans:n - ans + 1]
			print(len(t))
			print(*t)
		else:
			t = s[ans:n - ans + 1:2]
			print(len(t))
			print(*t)
main()


import sys
from math import *
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	c = abs(a - b)
	ans = []
	if c % 4 == 0:
		j = c // 4 * 2
		for i in range(a + 1):
			ans.append(j)
			j += 2
	if c % 4 == 2:
		j = (c - 2) // 4 * 2 + 1
		for i in range(a + 1):
			ans.append(j)
			j += 2
	if c % 4 == 3:
		j = (c - 3) // 4 * 2 + 1
		for i in range((a + 1) * 2):
			ans.append(j)
			j += 1
	if c % 4 == 1:
		j = (c - 1) // 4 * 2
		for i in range((a + 1) * 2):
			ans.append(j)
			j += 1
	print(len(ans))
	print(*ans)


from math import ceil
for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	avg = (a + b) // 2
	start = avg - min(a, b)
	end = min(ceil((a + b) / 2), a) + min(ceil((a + b) / 2), b)
	if (a + b) % 2 == 0:
		start = (max(a, b) - min(a, b)) // 2
		end = start + min(a, b) * 2
		print((end - start) // 2 + 1)
		k = []
		for i in range(start, end + 1, 2):
			k.append(i)
		print(*k)
	else:
		print(end - start + 1)
		k = []
		for i in range(start, end + 1):
			k.append(i)
		print(*k)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	total = a + b
	ans = []
	A = total // 2
	B = total - A
	res = abs(A - a)
	ans.append(res)
	if A != B:
		for i in range(min(a, b)):
			res += 2
			ans.append(res)
		(A, B) = (B, A)
		res = abs(A - a)
		ans.append(res)
		for i in range(min(a, b)):
			res += 2
			ans.append(res)
	else:
		for i in range(min(a, b)):
			res += 2
			ans.append(res)
	print(len(ans))
	print(*sorted(ans))


t = int(input())
for w in range(t):
	(a, b) = map(int, input().split())
	answer = set()
	games = a + b
	serves = games // 2
	for j in range(serves, -1, -1):
		breaks_first = max(a, b) - j
		breaks_second = serves - j
		if breaks_first > games - serves or breaks_second > serves:
			break
		answer.add(breaks_first + breaks_second)
	serves = games - serves
	for j in range(serves, -1, -1):
		breaks_first = max(a, b) - j
		breaks_second = serves - j
		if breaks_first > games - serves or breaks_second > serves:
			break
		answer.add(breaks_first + breaks_second)
	print(len(answer))
	answer = list(answer)
	answer.sort()
	print(' '.join(map(str, answer)))


t = int(input().strip())

def breaks(serves, won):
	bs = []
	for i in range(won + 1):
		bs.append(serves - i + (won - i))
	return bs
for _ in range(t):
	(a, b) = list(map(int, input().strip().split()))
	games = a + b
	mini = min(a, b)
	bs = []
	half = games // 2
	bs.extend(breaks(half, mini))
	if games % 2 == 1:
		half += 1
		bs.extend(breaks(half, mini))
	bs.sort()
	print(len(bs))
	print(*bs)


import sys
input = lambda : sys.stdin.readline()[:-1]
ni = lambda : int(input())
na = lambda : list(map(int, input().split()))
yes = lambda : print('yes')
Yes = lambda : print('Yes')
YES = lambda : print('YES')
no = lambda : print('no')
No = lambda : print('No')
NO = lambda : print('NO')
for _ in range(ni()):
	(a, b) = na()
	z = []
	if (a + b) % 2:
		A = (a + b) // 2
		B = (a + b + 1) // 2
		x = min(A, b) + min(a, B)
		for i in range(min(A, b, a, B) + 1):
			z.append(x - i * 2)
		(A, B) = (B, A)
		x = min(A, b) + min(a, B)
		for i in range(min(A, b, a, B) + 1):
			z.append(x - i * 2)
	else:
		A = (a + b) // 2
		B = (a + b + 1) // 2
		x = min(A, b) + min(a, B)
		for i in range(min(A, b, a, B) + 1):
			z.append(x - i * 2)
	print(len(z))
	print(*sorted(z))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	n = a + b
	aserve1 = n // 2
	bserve1 = n - aserve1
	bserve2 = n // 2
	aserve2 = n - bserve2
	minc1 = aserve1 - min(aserve1, a) + bserve1 - min(bserve1, b)
	maxc1 = min(aserve1, b) + min(bserve1, a)
	minc2 = aserve2 - min(aserve2, a) + bserve2 - min(bserve2, b)
	maxc2 = min(aserve2, b) + min(bserve2, a)
	s = set()
	for i in range(minc1, maxc1 + 1, 2):
		s.add(i)
	for i in range(minc2, maxc2 + 1, 2):
		s.add(i)
	ans = list(s)
	ans.sort()
	print(len(ans))
	print(*ans)


import math
import sys
import collections
import bisect
import time
import random
import itertools
from collections import Counter, defaultdict

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(int(input())):
	(a, b) = get_ints()
	d = abs(a - b) // 2
	ans = []
	if (a + b) % 2 == 0:
		v = d
		while True:
			if v > a + b - d:
				break
			ans.append(v)
			v += 2
	else:
		v = d
		while True:
			if v > a + b - d:
				break
			ans.append(v)
			v += 1
	print(len(ans))
	print(*ans)


import sys
import math
for _ in range(int(sys.stdin.readline())):
	(a, b) = map(int, sys.stdin.readline().split())
	if a > b:
		(a, b) = (b, a)
	small = math.floor((a + b) / 2)
	big = math.ceil((a + b) / 2)
	ans = set()
	start = b - big
	end = a + b - start
	for i in range(start, end, 2):
		if i not in ans:
			ans.add(i)
	for i in range(end, start - 1, -2):
		if i not in ans:
			ans.add(i)
	ans = list(ans)
	ans.sort()
	print(len(ans))
	print(*ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	tot = a + b
	fa = min(a, (tot + 1) // 2)
	sb = min(b, tot // 2)
	fb = min(b, (tot + 1) // 2)
	sa = min(a, tot // 2)
	mfa = min(fa, sb)
	l = fa + sb
	res = [l]
	while mfa:
		l -= 2
		mfa -= 1
		res += [l]
	l2 = fb + sa
	mfb = min(fb, fa)
	res += [l2]
	while mfb:
		l2 -= 2
		mfb -= 1
		res += [l2]
	s = set(res)
	res = sorted(list(s))
	print(len(res))
	print(*res, sep=' ')


from collections import deque, Counter
from collections import defaultdict as dfd
from bisect import bisect, bisect_left
from math import sqrt, gcd, ceil, factorial
from heapq import heapify, heappush, heappop
MOD = 10 ** 9 + 7
inf = float('inf')
ans_ = []

def nin():
	return int(input())

def ninf():
	return int(file.readline())

def st():
	return input().strip()

def stf():
	return file.readline().strip()

def read():
	return list(map(int, input().strip().split()))

def readf():
	return list(map(int, file.readline().strip().split()))

def readfl():
	return list(map(float, input().strip().split()))

def readffl():
	return list(map(float, file.readline().strip().split()))

def solve():
	for _ in range(nin()):
		(a, b) = read()
		ans = []
		if (a + b) % 2:
			maxi1 = (a + b) // 2 + (a + b) % 2 + min(a, b)
			maxi2 = (a + b) // 2 + min(a, b)
			for i in range(min(a, b) + 1):
				ans.append(maxi1 - 2 * i)
			for i in range(min(a, b) + 1):
				ans.append(maxi2 - 2 * i)
			ans.sort()
		else:
			maxi = min(a, b) + (a + b) // 2
			for i in range(min(a, b) + 1):
				ans.append(maxi - i * 2)
			ans.reverse()
		ans_.append(ans)
solve()
for i in ans_:
	print(len(i))
	print(*i)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	d = (max(a, b) - min(a, b)) // 2
	if (a + b) % 2 == 1:
		print(a + b - d + 1 - d)
		for i in range(d, a + b + 1 - d):
			if i == a + b - d:
				print(i)
				continue
			print(i, end=' ')
	else:
		print((a + b - d - d + 1 + 1) // 2)
		for i in range(d, a + b + 1 - d, 2):
			if i == a + b - d:
				print(i)
				continue
			print(i, end=' ')


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	mn = min(a, b)
	ans = set()
	for i in range(mn + 1):
		(e, o) = (i, mn - i)
		(l, m) = [(a + b) // 2, (a + b + 1) // 2]
		ans.add(l - e + o)
		ans.add(m - o + e)
	print(len(ans))
	print(*sorted(list(ans)))


import sys
import math
import random
from queue import PriorityQueue as PQ
from bisect import bisect_left as BSL
from bisect import bisect_right as BSR
from collections import OrderedDict as OD
from collections import Counter
from itertools import permutations
from decimal import Decimal as BIGFLOAT
from copy import deepcopy
mod = 1000000007
MOD = mod
sys.setrecursionlimit(1000000)
try:
	sys.stdin = open('actext.txt', 'r')
	OPENFILE = 1
except:
	pass

def get_ints():
	return map(int, input().split())

def palindrome(s):
	mid = len(s) // 2
	for i in range(mid):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True

def check(i, n):
	if 0 <= i < n:
		return True
	else:
		return False
t = int(input())
for tt in range(t):
	(a, b) = get_ints()
	aa = a
	bb = b
	ans = set()
	diff = abs(a - b)
	(d1, d2) = (math.floor(diff / 2), math.ceil(diff / 2))
	ans = set()
	for i in range(min(b, a) + 1):
		ans.add(i * 2 + d1)
		ans.add(i * 2 + d2)
	ans = list(ans)
	ans.sort()
	print(len(ans))
	print(*ans)


t = int(input())

def fun(n):
	if n % 2 == 0:
		return [n // 2]
	else:
		return [(n - 1) // 2, (n + 1) // 2]

def same(n):
	result = []
	for i in range(n + 1):
		result.append(2 * i)
	return result
while t > 0:
	t -= 1
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	p = max(a, b)
	q = a + b - p
	sum = a + b
	result = same(q)
	if sum % 2 == 0:
		temp = result.pop(-1)
		print(q + 1)
		for i in result:
			print(str(i + fun(p - q)[0]), end=' ')
		print(str(temp + fun(p - q)[0]))
	else:
		x_min = 0 + (p - q - 1) // 2
		x_max = 2 * q + (p - q + 1) // 2
		print(x_max - x_min + 1)
		for i in range(x_min, x_max):
			print(str(i), end=' ')
		print(x_max)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	arr = []
	if (a + b) % 2 == 0:
		ans = max(a, b) - (a + b) / 2
		for i in range(min(a, b) + 1):
			arr.append(int(ans))
			ans += 2
	else:
		ans = max(a, b) - int((a + b) / 2)
		for i in range(min(a, b) + 1):
			arr.append(int(ans))
			ans += 2
		ans = max(a, b) - (int((a + b) / 2) + 1)
		for i in range(min(a, b) + 1):
			arr.append(int(ans))
			ans += 2
	arr.sort()
	print(len(arr))
	print(*arr)


exec('\ndef my_solver_bitch(prakhar_shukla, sudheer_ranjan):\n    prakhar_shukla, sudheer_ranjan = min(prakhar_shukla, sudheer_ranjan), max(prakhar_shukla, sudheer_ranjan)\n    n = prakhar_shukla + sudheer_ranjan\n    res = set()\n    for i in range(0, prakhar_shukla + 1):\n        b1 = n // 2 - i + prakhar_shukla - i\n        res.add(b1)\n    for i in range(0, prakhar_shukla + 1):\n        b1 = n - n // 2 - i + prakhar_shukla - i\n        res.add(b1)\n    return res\n\n\nfor _ in range(int(input())):\n    a, b = map(int, input().split())\n    r = list(my_solver_bitch(a, b))\n    r.sort()\n    print(len(r))\n    print(*r)\n')


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().strip().split()))
	l = []
	if (a + b) % 2 == 0:
		total = a + b
		start = abs(a - b) // 2
		end = start
		while start != total - end:
			l.append(end)
			end += 2
		l.append(end)
	else:
		total = a + b
		start = abs(a - b) // 2
		end = start
		while start != total - end:
			l.append(end)
			end += 1
		l.append(end)
	print(len(l))
	for j in l[:-1]:
		print(j, end=' ')
	print(l[-1])


mm = int(input())
for i in range(mm):
	aa = []
	(a, b) = list(map(int, input().split()))
	n = max(a, b)
	z = (a + b) // 2
	s = a + b
	if (a + b) % 2 == 0:
		for ii in range(z + 1):
			if ii + z >= n:
				aa.append(z - ii + n - ii)
	else:
		for ii in range(z + 1):
			if ii + z + 1 >= n:
				aa.append(z - ii + n - ii)
		z = z + 1
		for ii in range(z + 1):
			if ii + s - z >= n:
				aa.append(z - ii + n - ii)
	aa.sort()
	print(len(aa))
	print(*aa)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	ans = set()
	if (a - b) % 2 == 0:
		for b1 in range(0, b + 1):
			a1 = (a - b) // 2 + b1
			if 0 <= a1 <= a:
				ans.add(a1 + b1)
	else:
		for b1 in range(0, b + 1):
			a1 = (a - b - 1) // 2 + b1
			a2 = (a - b + 1) // 2 + b1
			if 0 <= a1 <= a:
				ans.add(a1 + b1)
			if 0 <= a2 <= a:
				ans.add(a2 + b1)
	s = sorted(list(ans))
	print(len(s))
	print(*s)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	N = a + b
	s = set()
	x = N // 2
	y = 0
	for start in range(x - min(a, b), x + 1):
		s.add(x - min(a, b) + y)
		y += 2
	x = (N + 1) // 2
	y = 0
	for start in range(x - min(a, b), x + 1):
		s.add(x - min(a, b) + y)
		y += 2
	res = [i for i in s]
	res.sort()
	print(len(res))
	print(*res)


import math, bisect, heapq, random, sys, itertools
sys.setrecursionlimit(10 ** 6 + 10)
input = sys.stdin.readline
ints = lambda : list(map(int, input().split()))
p = 10 ** 9 + 7
alpha = 'abcdefghijklmnopqrstuvwxyz'
p2 = [1]
for i in range(30):
	p2.append(p2[i] * 2)
for t in range(int(input())):
	(a, b) = sorted(ints())
	store = set()
	x = (a + b) // 2
	y = a + b - x
	xx = x - a
	yy = 0
	while xx <= x and yy <= y:
		store.add(xx + yy)
		xx += 1
		yy += 1
	if (a + b) % 2:
		x = (a + b) // 2 + 1
		y = a + b - x
		xx = x - a
		yy = 0
		while xx <= x and yy <= y:
			store.add(xx + yy)
			xx += 1
			yy += 1
	print(len(store))
	print(*sorted(store))


t = int(input())
for tt in range(t):
	(a, b) = map(int, input().split())
	alice = (a + b + 1) // 2
	bob = (a + b) // 2
	ans = set()
	for x in range(bob + 1):
		y = b + x - bob
		if y >= 0 and y <= alice and (a == alice - y + x):
			ans.add(x + y)
	bob = (a + b + 1) // 2
	alice = (a + b) // 2
	for x in range(bob + 1):
		y = b + x - bob
		if y >= 0 and y <= alice and (a == alice - y + x):
			ans.add(x + y)
	ans = sorted(list(ans))
	print(len(ans))
	print(*ans)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	n = a + b
	br = []
	if n % 2 == 0:
		c_1 = n // 2
		a_0 = 0
		a_1 = 0
		b_0 = 0
		b_1 = 0
		for i in range(0, c_1 + 1):
			a_1 = i
			a_0 = a - i
			b_1 = c_1 - i
			b_0 = b - b_1
			if a_1 >= 0 and a_0 >= 0 and (b_1 >= 0) and (b_0 >= 0):
				br.append(a_1 + b_0)
	else:
		c_1 = n // 2
		a_0 = 0
		a_1 = 0
		b_0 = 0
		b_1 = 0
		for i in range(0, c_1 + 1):
			a_1 = i
			a_0 = a - i
			b_1 = c_1 - i
			b_0 = b - b_1
			if a_1 >= 0 and a_0 >= 0 and (b_1 >= 0) and (b_0 >= 0):
				br.append(a_1 + b_0)
		c_1 = n // 2 + 1
		a_0 = 0
		a_1 = 0
		b_0 = 0
		b_1 = 0
		for i in range(0, c_1 + 1):
			a_1 = i
			a_0 = a - i
			b_1 = c_1 - i
			b_0 = b - b_1
			if a_1 >= 0 and a_0 >= 0 and (b_1 >= 0) and (b_0 >= 0):
				br.append(a_1 + b_0)
	br = list(set(br))
	br.sort()
	print(len(br))
	print(*br)


import sys
import os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
depth = 1000005
mod = 1000000007
lim = mod * mod
sys.setrecursionlimit(depth)
from math import inf, ceil, sqrt
from collections import defaultdict
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	tot = a + b
	(odd, evn) = ((tot + 1) // 2, tot // 2)
	ans = set()
	for i in range(0, a + 1):
		oddplace = i
		evnplace = a - i
		if oddplace > odd:
			continue
		if evnplace > evn:
			continue
		remodd = odd - oddplace
		remevn = evn - evnplace
		breaks = evnplace + remodd
		ans.add(breaks)
	(odd, evn) = (tot // 2, (tot + 1) // 2)
	for i in range(0, a + 1):
		oddplace = i
		evnplace = a - i
		if oddplace > odd:
			continue
		if evnplace > evn:
			continue
		remodd = odd - oddplace
		remevn = evn - evnplace
		breaks = evnplace + remodd
		ans.add(breaks)
	print(len(ans))
	ans = list(ans)
	ans.sort()
	print(*ans)


t = int(input())
for _ in range(t):
	(A, B) = map(int, input().split())
	n = A + B
	l = []
	for i in range(0, n + 1):
		poss = False
		for a in [n // 2, (n + 1) // 2]:
			d = A - a
			b = n - a
			if i > b:
				ia = b - (i - b)
			else:
				ia = i
			if i > a:
				ib = a - (i - a)
			else:
				ib = i
			if (A + a + i) % 2 != 0:
				continue
			if A > a + ia or A < a - ib:
				continue
			poss = True
		if poss:
			l.append(str(i))
	print(len(l))
	print(' '.join(l))