#include #include #include #include #include #include #include #define ll long long #define uint unsigned int #define ull unsigned long long #define re register using namespace std; const ll N=5e5+10; const ll Z=1e9+7; inline ll read() { long long s=0,w=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { s=s*10+ch-'0'; ch=getchar(); } return s*w; } ll n,m; int main() { #ifndef ONLINE_JUDGE freopen("q.in","r",stdin); freopen("q.out","w",stdout); #endif ll T=read(); while(T--) { scanf("%lld%lld",&n,&m); bool flag=0; if(n>m) swap(n,m); if(n==m) { if(n==1) cout<<-1<<" "<<-1<