#include<bits/stdc++.h>
using namespace std;
long long k,s;
void f(long long n,long long e,long long d){
long long i =(e*d-n-2)*(e*d-n-2)-4*n;
long long t = sqrt(i);
if(i<0||t*t!=i){
cout<<"NO"<<endl;
return;
}
long long p=(n+2-e*d-sqrt(i))/2;
long long q=(n+2-e*d+sqrt(i))/2;
cout<<p<<' '<<q<<endl;
}
int main(){
freopen("csp2022pj_decode.in","r",stdin);
freopen("csp2022pj_decode.out","w",stdout);
cin>>k;
for(int i=1;i<=k;i++){
long long x,y,z;
cin>>x>>y>>z;
f(x,y,z);
}
return 0;
}