#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = int64_t; using ull = uint64_t; using vl = vector; using vvl = vector;using vvvl = vector; using vb = vector; using vvb = vector;using vvvb = vector; using vs = vector; using vvs=vector>; using pl = pair; using vpl = vector;using vvpl = vector; using tl = tuple; using vtl = vector;using vvtl = vector>; using sl = set; using vsl = vector; using vvsl = vector; using ml = map; using vml = vector; using vvml = vector; using usl = unordered_set; using vusl = vector; using vvusl = vector; using uml = unordered_map; using vuml = vector; using vvuml = vector; using mint = atcoder::modint998244353; using vm = vector; using vvm = vector>; using vvvm = vector; #define rep1(a) for (ll _ = 0; _ < ll(a); ++_) #define rep2(i, a) for (ll i = 0; i < ll(a); ++i) #define rep3(i, a, b) for (ll i = a; i < ll(b); ++i) #define rrep1(a) for (ll i = (a)-1; i >= ll(0); --i) #define rrep2(i, a) for (ll i = (a)-1; i >= ll(0); --i) #define rrep3(i, a, b) for (ll i = (b)-1; i >= ll(a); --i) #define overload3(a, b, c, d, ...) d #define rep(...) overload3(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__) #define rrep(...) overload3(__VA_ARGS__, rrep3, rrep2, rrep1)(__VA_ARGS__) #define in(i,vec) for (auto i:(vec)) #define siz(a) ll(a.size()) void YesNo(bool a){cout<<(a?"Yes\n":"No\n");} template using pqueue = priority_queue>;//大きい順 template using pqueue_g = priority_queue, greater>;//小さい順 template bool chmin(T& x, T y){if(x>y){x=y;return true;}else return false;} template bool chmax(T& x, T y){if(x void sor(vector& v){sort(v.begin(),v.end());} template void sor_g(vector& v){sort(v.begin(),v.end(),greater<>());} template void vin(vector& v){size_t N = v.size();for(size_t i=0;i>v[i];} template void vvin(vector>& v){size_t N=v.size(),M=v[0].size();for(size_t i=0;i>v[i][j];} pair d1{1,0},d2{0,1},d3{-1,0},d4{0,-1},d5{1,1},d6{-1,1},d7{1,-1},d8{-1,-1}; ll inf = 1e18; int infi = 1e9; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll T; cin>>T; rep(T){ ll sx,sy,tx,ty; cin>>sx>>sy>>tx>>ty; ll ans = inf; rep(d,62){ ll a = abs(sy-d)+abs(d-ty)+abs((sx>>d)-(sy>>d)); chmin(ans,a); } cout<