#include int main() { long long seq[200]; int x, y; for(;;) { int count1 = 0; scanf ("%lld%lld", &x, &y); long long x1 = x; long long y1 = y; if (!x && !y) break; for(;;) { seq[count1] = x; if (x == 1) break; if (x % 2 == 0) x /= 2; else x = x * 3 + 1; count1++; } int count2 = 0; for(;;) { if (y == 1) break; for (int i = 0; i < count1; i++) if (seq[i] == y) { count1 = i; goto end; } if (y % 2 == 0) y /= 2; else y = y * 3 + 1; count2++; } end: printf("%lld needs %d steps, %lld needs %d steps, they meet at %lld\n", x1, count1, y1, count2, seq[count1]); } return 0; }