#include <iostream>
using namespace std;
int main() {
int t,a1,a2,a3,a4;
cin>>t;
for(int i=0;i<t;i++){
cin>>a1>>a2>>a3>>a4;
if(a1+a4==a2+a3)cout<<a1<<" "<<a2<<" "<<a3<<" "<<a4<<" "<<a4+a2-a1<<"\n";
else cout<<a1<<" "<<a2<<" "<<a3<<" "<<a4<<" "<<a4*a2/a1<<"\n";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgdCxhMSxhMixhMyxhNDsKCWNpbj4+dDsKCWZvcihpbnQgaT0wO2k8dDtpKyspewoJY2luPj5hMT4+YTI+PmEzPj5hNDsKCWlmKGExK2E0PT1hMithMyljb3V0PDxhMTw8IiAiPDxhMjw8IiAiPDxhMzw8IiAiPDxhNDw8IiAiPDxhNCthMi1hMTw8IlxuIjsKCWVsc2UgY291dDw8YTE8PCIgIjw8YTI8PCIgIjw8YTM8PCIgIjw8YTQ8PCIgIjw8YTQqYTIvYTE8PCJcbiI7Cgl9CglyZXR1cm4gMDsKfQ==