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