#include<iostream>
#include<cmath>

using namespace std;

 int main()
{
int T, A, B, i, j, x, y, k, br=0;
cout <<" Unesi T"<< endl;
cin>> T;
for(k=1; k<=T; k++)
{
cout<<" unesi A i B "<< endl;
cin>>A>>B;
 int broj= max(A,B)/2;
if (T<=1 || T > 10000) return -1;
if(B > pow (2,62) ||  A%2==0) return -1;
for(i=1; i< broj; i=i+2)
{if(br!=1)
    for(j=1; j<=broj;j=j+2)
        {
            x=i*j;
            y=i^j;
            if(x== A && y==B)
            {
            br=1;
            if(br==1)cout<<j<<i;
            }
        }
}
}
return -1;
}