for i in range(int(input())):
s, d = map(int, input().split()) # s = 總和, d = 差
# 檢查是否為偶數
if (s + d) % 2 != 0 or (s - d) % 2 != 0:
print("impossible")
continue
a = (s + d) // 2 # a > b
b = (s - d) // 2 # a, b 一定要是整數
# 檢查是否為非負整數且 a >= b
if a >= 0 and b >= 0 and a >= b: # 在python中 and是左結合 所以會先判斷 a >= 0 and b >= 0 再判斷 a >= b
print(f"{a} {b}")
else:
print("impossible")