#include using namespace std; using ll = long long; #define rep(i, n) for (ll i = 0; i < (n); i++) void solve() { ll sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty; if (sy > ty) { swap(sx, tx); swap(sy, ty); } cout << abs((sx>>min(63LL, ty)) - (tx>>min(63LL, ty))) + abs(sy - ty) << endl; } int main() { ll t; cin >> t; while (t--) solve(); return 0; }