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