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 = '#!/usr/bin/python\n\nimport sys\nimport math\n\ncache_parent = {}\n  \ndef find_chain_1(num1, parent_c1): \n while True:\n  if num1 in cache_parent:\n   parent_c1.extend(cache_parent[num1])\n   return parent_c1\n  parent_c1.append(num1)\n  if num1 == 1:\n   return\n  num1 = int(num1/2)\n\ndef find_chain_2(num2, parent_c2): \n while True:\n  if num2 in cache_parent:\n   parent_c2.extend(cache_parent[num2])\n   return parent_c2\n  parent_c2.append(num2)\n  if num2 == 1:\n   return\n  num2 = int(num2/2)\n \ndef getlen(chain_1, chain_2, num1, num2):\n """if len(chain_1) > len(chain_2):\n     shorter = chain_2\n     larger = chain_1\n    else:\n     shorter = chain_1\n     larger = chain_2\n    for i in shorter:\n     if i in larger:\n      root = i\n      break"""\n root = list(set(chain_1) & set(chain_2))\n root.sort()\n root = root[-1]\n #distance = int(math.log(num1, 2) + 1) + int(math.log(num2, 2) + 1)   - 2\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0*int(math.log(root, 2)+1)\n #print root\n distance = chain_1.index(root) + chain_2.index(root)\n return distance\n\nlines = sys.stdin.readlines()\nfor num in lines[1:]:\n num1, num2 = num.strip().split(\' \')\n num1 = int(num1)\n num2 = int(num2) \n parent_c1 = [] \n parent_c2 = []\n find_chain_1(num1, parent_c1)\n cache_parent[num1] = parent_c1\n #print parent_c1 \n find_chain_2(num2, parent_c2)\n cache_parent[num2] = parent_c2\n #print parent_c2\n print(getlen(parent_c1, parent_c2, num1, num2))'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14151