# include<iostream>
using namespace std;
int main()
{
int a=0,b=0,c=0,d=0,t=0;
cin>>t;
while(0<=t<=20)
{
cin>>a>>b>>c>>d;
if((c-b)==(d-c))
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d+(b-a)<<endl;
else
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<b/a*d<<endl;
}
}