#include using namespace std; const int maxn = 1e5+5; const int mod=1e9+7; #define ll long long #define IOS ios::sync_with_stdio(false),cin.tie(0) ll isp(ll n){ for(ll i=2;i*i<=n;++i){ if(n%i==0) return i; } return n; } int main(){ IOS; int t; cin>>t; while(t--){ ll a,b; cin>>a>>b; if(a>b) swap(a,b); ll c=b-a; if(c==1) cout<<-1<<" "<<-1<<"\n"; else if(c==0){ if(a==1) cout<<-1<<" "<<-1<<"\n"; else cout<<2<<" "<