import java.util.*;
import java.*;

import java.util.List;

public class collatz
{
	public static void main(String[] args)
	{	
		for(;;){
		long a = 0;
		long b = 0; 
		try{
			a = System.in.read() - '0';			
			long in = System.in.read();
			while(in != ' '){
				a = a * 10 + (in - '0');
				in = System.in.read();
			}

			b = System.in.read() - '0';			
			in = System.in.read();
			while(in != '\n'){
				b = b * 10 + (in - '0');
				in = System.in.read();
			}
		}catch(Exception ex){}
		
	
		if(a == 0 && b == 0)
		{
			break;
		}

		List<Long> ph = fillCollins(a);
		List<Long> co = fillCollins(b);
		long phil = findSamePhil(ph,co);		

		System.out.println(a + " needs " + findIndex(ph,phil) +" steps, " + b + " needs " + findIndex(co,phil) + " steps, " + "they meet at "+phil);
		
	}
		
	}

	private static int findIndex(List<Long> a, long value)
	{
		int position = 0;
		for(long i : a)
		{
			if(i == value)
			{
				break;
			}
			position++;		
		}
		return position;
	}


	private static List<Long> fillCollins(long a)		
	{
		long phil = a;
		List<Long> collins = new ArrayList<Long>();
		collins.add(phil);

		while(phil != 1)
		{
			if(phil % 2 == 0)
			{
				phil = phil / 2;					
			}
			else
			{
				phil = phil*3+1;
			}
			collins.add(phil);	
		}

		return collins;
	}

	private static long findSamePhil(List<Long> a, List<Long> b)
	{
		long samePhil = 0;
		boolean added = false;
		boolean gotCollins = false;
		for(long i : a)
		{
			for(long j : b)
			{
				if(i == j)
				{
					
						samePhil = i;
						added = true;
						break;
						
					
					
				}
			}
			if(added)
			{
				break;
			}
		}
		return samePhil;
	}
}
