#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll k, l, m, n;
int main() {
int t;
scanf("%d", &t);
while(t--) {
scanf("%lld%lld%lld%lld", &k, &l, &m, &n);
ll a = k, b = l;
ll s1 = m, s2 = n;
double f = sqrt(s2) / sqrt(s1);
cout << fixed << setprecision(10) << a*f-b << " " << b*f-a << endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnR5cGVkZWYgbG9uZyBsb25nIGxsOwp1c2luZyBuYW1lc3BhY2Ugc3RkOwpsbCBrLCBsLCBtLCBuOwppbnQgbWFpbigpIHsKICBpbnQgdDsKICBzY2FuZigiJWQiLCAmdCk7CiAgd2hpbGUodC0tKSB7CiAgICBzY2FuZigiJWxsZCVsbGQlbGxkJWxsZCIsICZrLCAmbCwgJm0sICZuKTsKICAgIGxsIGEgPSBrLCBiID0gbDsKICAgIGxsIHMxID0gbSwgczIgPSBuOwogICAgZG91YmxlIGYgPSBzcXJ0KHMyKSAvIHNxcnQoczEpOwogICAgY291dCA8PCBmaXhlZCA8PCBzZXRwcmVjaXNpb24oMTApIDw8IGEqZi1iIDw8ICIgIiA8PCBiKmYtYSA8PCBlbmRsOwogIH0KICByZXR1cm4gMDsKfQ==