import sys
from sys import stdout
input = sys.stdin.readline
inf = float('inf')
def getInt():
return int(input())
def getStr():
return input().strip()
def getList(split=True):
s = getStr()
if split:
s = s.split()
return list(map(int, s))
t = getInt()
def solve():
a, b = getList()
n = a+b
res = set()
for hold in {n >> 1, n+1 >> 1}:
for Break in range(min(n-hold, a)+1):
if 0 <= hold - a + Break <= b:
res.add(2*Break+hold-a)
print(len(res))
print(*sorted(res))
for _ in range(t):
solve()
265A - Colorful Stones (Simplified Edition) | 296A - Yaroslav and Permutations |
967B - Watering System | 152A - Marks |
1398A - Bad Triangle | 137A - Postcards and photos |
1674D - A-B-C Sort | 334A - Candy Bags |
855A - Tom Riddle's Diary | 1417A - Copy-paste |
1038A - Equality | 1061A - Coins |
1676E - Eating Queries | 1447A - Add Candies |
1721D - Maximum AND | 363C - Fixing Typos |
1401A - Distance and Axis | 658A - Bear and Reverse Radewoosh |
1721E - Prefix Function Queries | 977E - Cyclic Components |
1140D - Minimum Triangulation | 75C - Modified GCD |
1722A - Spell Check | 1722B - Colourblindness |
1722D - Line | 1722C - Word Game |
1722G - Even-Odd XOR | 552E - Vanya and Brackets |
933A - A Twisty Movement | 1722F - L-shapes |