#include <iostream>
using namespace std;

unsigned int res=0;

unsigned int gcd(unsigned int x,unsigned int y) {
  if(y == 0) return x;
  else {
    res++;
    return gcd(y,x%y);
  }
}

int main() {
 unsigned int x,y;
  while(cin >> x >> y) {
    if(x==0&&y==0) break;
    cout << gcd(x,y) << " " << res << endl;
    res = 0;
  }
}