#include <iostream>
using namespace std;
bool subornot(int aray[]){ //如果不是等差返回true,否則反之
if(aray[1]-aray[0]!=aray[2]-aray[1]){
return true;
}else return false;
}
int main() {
int n,i,count=1;
int aray[5];
cin>>n;
while(count<=n){ //幾次的數列輸入與輸出
for(int a=0;a<=3;a++){
cin>>aray[a]; //數列輸入
}
if(subornot(aray)){
aray[4]=aray[3]*(aray[3]/aray[2]); //等比
for(i=0;i<=4;i++){
cout<<aray[i]<<" ";
}
cout<<endl;
}else{
aray[4]=aray[3]+(aray[3]-aray[2]); //等差
for(i=0;i<=4;i++){
cout<<aray[i]<<" ";
}
cout<<endl;
}
count++;
}
return 0;
}