using namespace std;
int main()
{
int z ,a, b, c, d, e ,i;
cin>>z;
for(i=1 ;i<=z ;i++){
cin>>a>>b>>c>>d
if (b/a == c/b)
{
e= d*b/a;
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;
}
else if(b-a == c-b)
{
e = d+d-c;
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;
}
}
return 0;
}