#include<stdio.h>
int count(int n)
{
//sum爲循環節長度
int sum = 1;
while(n != 1)
{
n = (n%2 == 0) ? n/2 : 3*n+1;
sum++;
}
return sum;
}
int calculate(int i, int j)
{
//n用來遍歷從i到j
int n = 0;
//outcome是最終結果
int outcome = 0;
//temp中間變量
int temp = 0;
for(n = i; n <= j; n++)
{
temp = count(n);
if(outcome < temp)
outcome = temp;
}
return outcome;
}
void main()
{
//定義兩個變量,表示從i到j的全部數
int i = 0, j = 0;
//將數據讀到a和b數組中去
int a[10] = {0}, b[10] = {0};
//n是循環節長度
int n = 0;
//表明是第幾組數據
int x = 0;
//中間變量
int temp = 0;
for(x = 0; x < 4; x++)
scanf("%d %d",&a[x],&b[x]);
x = 0;
while (x < 4)
{
i = a[x];
j = b[x];
temp = calculate(i,j);
printf("%d %d %d\n",i,j,temp);
x++;
}
}