#include using namespace std; using ll = long long; #define rep(i, a, b) for (ll i = (a); i < (ll)(b); i++) #define all(x) x.begin(), x.end() void solve() { ll sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty; ll max_bit = 0; rep(i, 0, 62) { if ((sx ^ tx) & (1LL << i)) { max_bit = i; } } ll ans = 0; ans += max(0LL, max_bit - sy); ans += abs(max(max_bit, sy) - ty); cout << ans << '\n'; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T = 1; cin >> T; while (T--) { solve(); } }