#include <bits/stdc++.h>
using namespace std;
struct Point {
double x, y;
};
int t;
Point A, B;
double dist(Point A, Point B) {
return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
}
int main() {
cin >> t;
while (t--) {
cin >> A.x >> A.y >> B.x >> B.y;
A.y = abs(A.y);
B.y = abs(B.y);
Point antiB;
antiB.x = B.x;
antiB.y = -B.y;
int res = dist(A, antiB);
cout << res << "\n";
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdHJ1Y3QgUG9pbnQgewogICAgZG91YmxlIHgsIHk7Cn07CgppbnQgdDsKUG9pbnQgQSwgQjsKCmRvdWJsZSBkaXN0KFBvaW50IEEsIFBvaW50IEIpIHsKICAgIHJldHVybiBzcXJ0KChBLnggLSBCLngpICogKEEueCAtIEIueCkgKyAoQS55IC0gQi55KSAqIChBLnkgLSBCLnkpKTsKfQoKaW50IG1haW4oKSB7CiAgICBjaW4gPj4gdDsKICAgIHdoaWxlICh0LS0pIHsKICAgICAgICBjaW4gPj4gQS54ID4+IEEueSA+PiBCLnggPj4gQi55OwogICAgICAgIEEueSA9IGFicyhBLnkpOwogICAgICAgIEIueSA9IGFicyhCLnkpOwoKICAgICAgICBQb2ludCBhbnRpQjsKICAgICAgICBhbnRpQi54ID0gQi54OwogICAgICAgIGFudGlCLnkgPSAtQi55OwoKICAgICAgICBpbnQgcmVzID0gZGlzdChBLCBhbnRpQik7CiAgICAgICAgY291dCA8PCByZXMgPDwgIlxuIjsKICAgIH0KICAgIHJldHVybiAwOwp9Cg==