def main(): t = int(input()) for _ in range(t): sx, sy, tx, ty = map(int, input().split()) if sy > ty: sx, sy, tx, ty = tx, ty, sx, sy h = ty - sy if ty >= 70: w = 0 else: sx, tx = min(sx, tx), max(sx, tx) sx //= 1 << ty tx //= 1 << ty w = tx - sx print(h + w) if __name__ == "__main__": main()