#include <iostream>
#include <utility>
using namespace std;
typedef pair<int,int> p;

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;
  while(cin >> x >> y) {
    if(x==0&&y==0) break;
    cout << gcd(x,y) << " " << res << endl;
    res = 0;
  }
}