根据因数构造
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1e9+7;
const int INF=0x3f3f3f3f;
const int N = 1e5+10;
#define ios \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
int main()
{
int t;cin>>t;
while(t--)
{
long long a,b,c,d;
cin>>a>>b>>c>>d;
int flag=0;
for(long long i=a+1;i<=c;i++)
{
ll k=__gcd(a*b,i);
ll x=a*b/k;
x=b/x*x+x;
if(x<=d)
{
flag=1;
cout<<i<<" "<<x<<endl;
break;
}
}
if(flag==0)
{
cout<<-1<<" "<<-1<<endl;
}
}
}