1 #include <iostream>
2 #include <cstdio>
3
4 using namespace std;
5
6 #define LL long long
7 #define max(a,b) (a>b?a:b)
8 #define min(a,b) (a<b?a:b)
9 inline void read(LL &x)
10 {
11 x=0; register char ch=getchar();
12 for(; ch>'9'||ch<'0'; ) ch=getchar();
13 for(; ch>='0'&&ch<='9'; ch=getchar()) x=x*10+ch-'0';
14 }
15 LL a,b,sum[1000000];
16
17 LL DFS(LL now)
18 {
19 if(now==1) return 0;
20 if(now<1000000)
21 {
22 if(sum[now]) return sum[now];
23 else return now&1 ? sum[now]=DFS(now*3+1)+1 : sum[now]=DFS(now>>1)+1;
24 }
25 else return now&1 ? DFS(now*3+1)+1 :DFS(now>>1)+1;
26 }
27
28 int Presist()
29 {
30 int t;
31 for(scanf("%d",&t); t--; )
32 {
33 LL ans=0; read(a),read(b);
34 for(LL i=min(a,b); i<=max(a,b); ++i)
35 ans=max(DFS(i),ans);
36 printf("%lld\n",ans);
37 }
38 return 0;
39 }
40
41 int Aptal=Presist();
42 int main(){;}