
import std.stdio;

int gcd(int a, int b, ref int step) {
  if (b == 0) return a;
  else {
    step++;
    return gcd(b, a % b, step);
  }
}

void main() {
  for(int a, b; readf("%d %d\n", &a, &b), a + b != 0;) {
    int step = 0;
    int result = gcd(a, b, step);
    writeln(result, " ", step);
  }
}