#include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef long long ll; const int maxn = 4e6 + 7; const int mod = 1e9 + 7; int n , k , m; int T; ll a ,b; int main() { cin>>T; while(T--){ cin>>a>>b; ll c = abs(a - b); ll d = c; if(c == 1){ printf ("-1 -1\n"); continue; } if(a == b){ if(a == 1) printf ("-1 -1\n"); else printf ("%d %d\n",2 , a); continue; } for(int i = 2; i * i <= c; i ++){ if(c % i == 0){ d = i; break; } } cout<