#include <iostream>
using namespace std;
int main()
{
int T;
cin>>T;
for(int o=0;o<T;o++)
{
int a,b,c,d;
cin>>a>>b>>c>>d;
if((b-a)==(c-b) && (b-a)==(d-c))
{
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d+b-a<<endl;
continue;
}
if(b%a==0 && c%b==0 && d%c==0 && (b/a)==(c/b) && (b/a)==(d/c))
{
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d*(b/a)<<endl;
continue;
}
}
return 0;
}