#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//判断一元二次函数是否有正整数解
int main()
{
freopen("csp2022pj_decode.in","r",stdin);
freopen("csp2022pj_decode.out","w",stdout);
ll k,p,q,m,n,e,d,flag;
cin>>k;
for(int i=1;i<=k;i++)
{
cin>>n>>e>>d;
m = n - e * d + 2;
ll d = m * m - n - n - n - n;
flag = 1;
if(d<0 ) flag = 0;//无实数根
if(d>=0)
{
ll x=sqrt(1.0*d);
if(x * x != d ) flag = 0;//无整数根
}
if(d>=0 && flag==1)
{
p = (m + (ll)sqrt(1.0*d))/2;
q = (m - (ll)sqrt(1.0*d))/2;
if(!(p>0 && q>0)) flag = 0;
}
if(flag)
{
if(p>q)
{
ll t;
t = p;p = q;q = t;
}
cout<<p<<' '<<q<<endl;
}
else
cout<<"NO"<<endl;
}
return 0;
}