inf = 10**19 def solve(): sx, sy, tx, ty = map(int, input().split()) if sx > tx: sx, sy, tx, ty = tx, ty, sx, sy base_cost = abs(sy - ty) Y = max(sy, ty) up = 0 ans = 10**18 # print(Y) while True: t_len = 1<<(Y+up) if (Y+up) < 60 else inf tr = tx // t_len tl = sx // t_len dist = tr - tl # print(up, t_len, dist) ans = min(ans, dist + up*2) if dist == 0: break up += 1 print(ans + base_cost) for _ in range(int(input())): solve()