#include <iostream>
using namespace std;

int res=0;

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

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