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