#include <bits/stdc++.h>
using namespace std;
typedef long double ld;

ld dist(pair<ld,ld> a,pair<ld,ld> b){
    ld dx=abs(a.first-b.first),dy=abs(a.second-b.second);
    return sqrt(dx*dx+dy*dy);
}
int main(){
    ios::sync_with_stdio(0);
    int n; cin>>n;
    while (n--){
        ld ax,ay,bx,by; cin>>ax>>ay>>bx>>by;
        cout<<fixed<<setprecision(3)<<dist({ax,ay},{bx,by})+dist({ax,-ay},{-bx,by})<<endl;
    }
}