#include<bits/stdc++.h>
using namespace std;
int k;
int bol=0;
unsigned long long n,e,d,m;
int main()
{
freopen("csp2022pj_decode.in","r",stdin);
freopen("csp2022pj_decode.out","w",stdout);
cin>>k;
for(int i=k;i>0;i--)
{
bol=0;
cin>>n>>e>>d;
m=n-e*d+2;
for(unsigned long long p=1;p<=m/2;p++)
{
unsigned long long q=m-p;
if(q*p==n&&e*d==(p-1)*(q-1)+1)
{
cout<<p<<' '<<q<<endl;
bol=1;
break;
}
}
if(bol==0)
cout<<"NO"<<endl;
}
}