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