#include <iostream>
using namespace std;
int main()
{
int f;
cin>>f ;
int a[5] ,d ,r;
for(int i=0;i<=f;i++)
{
cin>> a[0] >> a[1] >> a[2] >> a[3] ;
if(a[2]-a[1]==a[3]-a[2])
{
d=a[3]-a[2];
a[4]=a[3]+d;
cout<< a[0] <<" "<< a[1] <<" "<< a[2]<<" " << a[3]<<" " << a[4] << endl;
}else
{
r=a[3]/a[2];
a[4]=a[3]*r;
cout<< a[0] <<" "<< a[1]<<" " << a[2]<<" " << a[3]<<" " << a[4] << endl;
}
}
}