Consider an infinite full binary tree (each node has two children except the leaf nodes) defined as follows. For a node labelled v its left child will be labelled 2*v and its right child will be labelled 2*v+1. The root is labelled as 1.
You are given N queries of the form i j. For each query, you have to print the length of the shortest path between node labelled i and  node labelled j.

-----Input-----
First line contains N, the number of queries. Each query consists of two space separated integers i and j in one line.

-----Output-----
For each query, print the required answer in one line.

-----Constraints-----
- 1 ≤ N ≤ 105
- 1 ≤ i,j ≤ 109

-----Example-----
Input:
3
1 2
2 3
4 3

Output:
1
2
3

-----Explanation-----
For first query, 1 is directly connected to 2 by an edge. Hence distance 1.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import math\nimport sys\nimport time\n\n\ndef getLevel(number):\n _level = math.floor(math.log(number,2))\n return int(_level)\n\ndef isPair(number):\n return (number%2 == 0)\n \ndef getInterval(a,b, max):\n _max = max\n _loop = -1\n _apart = 0\n \n while (_apart == 0) and (_max != 1):\n  _loop += 1\n  _max = _max >> 1\n  if (a < _max) and (b >= _max):\n   _apart = 1\n  elif (a >= _max):\n   a = a - _max\n   b = b - _max\n \n return _loop\n\ndef resolve2(nodes):\n \n if nodes[0] == nodes[1]:\n  return 0\n\n l = 0\n k = 0\n \n while (nodes[0] != nodes[1]) :\n  if (nodes[1] < nodes[0]) :\n   if (nodes[0] > 1):\n    nodes[0] = nodes[0]/2 if isPair(nodes[0]) else (nodes[0] -1)/2\n    l += 1\n  else:\n   if (nodes[1] > 1):\n    nodes[1] = nodes[1]/2 if isPair(nodes[1]) else (nodes[1] -1)/2\n    k += 1\n  \n return (l + k)\n \n\ndef __starting_point():\n\n step = 0\n \n for line in sys.stdin:\n  \n  if (step==0):\n   step = 1\n   continue\n  nodes =[int(nums) for nums in line.strip().split()]\n  \n  \n  if nodes[0] == nodes[1]:\n   print(0)\n   continue\n \n  _temp = nodes[0]\n  if nodes[0] < nodes[1] :\n   nodes[0] = nodes[1]\n   nodes[1] = _temp\n  \n  _max_level = getLevel(nodes[0])\n  if (nodes[1] == 1):\n   print(_max_level)\n   continue\n  \n  _min_level = getLevel(nodes[1])\n  substract = _max_level - _min_level\n  \n  \n  if (substract != 0):\n   nodes[0] = nodes[0] >> substract\n  \n  _temp = nodes[0]\n  if nodes[0] < nodes[1] :\n   nodes[0] = nodes[1]\n   nodes[1] = _temp\n  \n  \n  if (nodes[1] == nodes[0]):\n   print( substract)\n   continue\n\n  _max = 2**_min_level\n  \n  apart = getInterval(nodes[1] - _max, nodes[0] - _max,_max)\n  \n  \n  print( 2*(_min_level - apart) + substract)\n  \n  \n  #print( resolve2(nodes) )\n\n__starting_point()'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15650