#include using namespace std; int main(){ int T; cin >> T; while(T--){ long long a,b; cin >> a >> b; long long mmax = -1, mmin = -1; if(a == b){ if(a == 1){ mmin = -1; mmax = -1; } else{ mmin = 2; mmax = a; } } else{ long long temp = abs(a-b); if(temp == 0 || temp == 1){ mmax = -1; mmin = -1; } else{ mmax = temp; mmin = temp; } for(int i = 2; i <= sqrt(temp)+1; i++){ if(temp % i == 0){ mmin = i; break; } } } cout << mmin << ' ' << mmax << endl; } }