Question of bitset

alice and bob were performing n bit ripple carry adder operation on two number (x and y). Alice got the correct answer i.e A but bob got the wrong answer i.e B. After sometime they got to know that bob was ignoring carry while performing the operation.

Given the values of A and B, your mission is to find out the values x and y.

You are given Q queries containing the values of A and B. Find the possible values of x and y. Refer the output section for more information

if there exist more than one solution output will be the pair (x,y) separated with the smallest possible x
if there exist no solution then output -1
4 2
3 4
1 3

ans is probably (a+b)/2,(a-b)/2 can anyone plz help here