Code: Select all
#include<bits/stdc++.h>
using namespace std;
typedef long double ll;
int main(){
//freopen("FighterAttack.txt", "r", stdin);
//freopen("FighterShow.txt", "w", stdout);
ll A,B,C,n;
cin>>n;
while(n--)
{
ll minx=6000000000000,miny=600000000000,minz=0;
bool flag=false;
cin>>A>>B>>C;
for(ll x=0; x<=100000 ; x++)if(x*x<=C && ceil(B/x)==floor(B/x)){
for(ll y=0; y<=1000000; y++)if(x!=y && x*x+y*y<=C && ceil(B/y)==floor(B/y)){
ll z = A-(x+y);
if(x+y+z==A && x*y*z==B && x*x+y*y+z*z==C && x!=y && x!=z && y!=z){
if(x<minx){minx=x; miny=y; minz=z; flag=true;}
else if(x==minx){ if(y<miny){minx=x; miny=y; minz=z;} }
}
}
}
if(flag)
cout<<minx<<" "<<miny<<" "<<minz<<endl;
else
cout<<"No solution.\n";
}
return 0;
}