import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class collatz {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        
        while (true) {
            List<Integer> a = new ArrayList<Integer>();
            List<Integer> b = new ArrayList<Integer>();

            int a0, b0, startA, startB, stepA = 0, stepB = 0, met = -1;
            startA = sc.nextInt();
            startB = sc.nextInt();
            
            if (startA+startB == 0) {
                System.exit(0);
            }

            a0 = startA;
            b0 = startB;

            a.add(a0);
            b.add(b0);

            while (true) {

                met = a.indexOf(b0);

                if (met != -1) {
                    stepA = met;
                    break;
               }

                if (a0 % 2 == 0) {
                    a0 = a0 / 2;
                    a.add(a0);
                } else {
                    a0 = 3*a0+1;
                    a.add(a0);
                }

                stepA++;

                met = b.indexOf(a0);

                if (met != -1) {
                    stepB = b.indexOf(a0);
                    break;
                } else {
                    if (b0 % 2 == 0) {
                        b0 = b0 / 2;
                        b.add(b0);
                    } else {
                        b0 = 3*b0+1;
                        b.add(b0);
                    }

                    stepB++;
                }

            }

            System.out.format("%d needs %d steps, %d needs %d steps, they meet at %d\n",  startA, stepA, startB, stepB, stepA>=stepB?b.get(met):a.get(met));

        }
    }

}
