#include //#include #include #include using namespace std; typedef long long ll; map A; void simulate(ll x) { int cnt = 0; A[x] = cnt; while(x != 1) { cnt++; if(x % 2 == 0) { x /= 2; } else { x *= 3; x++; } if(!A.count(x)) { A[x] = cnt; } } } int main() { ll a, b; while(cin >> a >> b) { A.clear(); if(a == 0 and b == 0) { break; } simulate(a); ll tmp = b; int cnt = 0; while(true) { if(A.count(b)) { break; } if(b % 2 == 0) { b /= 2; } else { b *= 3; b++; } cnt++; } cout << a << " needs " << A[b] << " steps, " << tmp << " needs " << cnt << " steps, they meet at " << b << endl; } return 0; } /* 7 needs 13 steps, 8 needs 0 steps, they meet at 8 27 needs 95 steps, 30 needs 2 steps, they meet at 46 **/