#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
typedef long long LL;
LL n,e,d;
LL m,k;
LL q,p;
int main()
{
scanf("%d",&k);
for(int i=1;i<=k;i++)
{
scanf("%lld%lld%lld",&n,&e,&d);
m=n-e*d+2;
LL x=sqrt(m*m-4*n);
if(x*x!=m*m-4*n) puts("NO");
else printf("%d %d\n",(m-x)/2,(m+x)/2);
}
return 0;
}