
import std.stdio;

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

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