#include <iostream>
#include <algorithm>
using namespace std;

int cnt;

int gcd(int a,int b){ 
  if(a==0 || b==0) return 0;
  if(a<b) swap(a,b);
  while(b!=0) {
    a%=b;
    swap(a,b);
    cnt++;
  }
  return a;
}

int main() {
  int a,b;
  while(cin >> a >> b && (a!=0 || b!=0)) {
    cnt=0;
    int g=gcd(a,b);
    cout << g << " " << cnt << endl;
  }
  return 0;
}
