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