#include <bits/stdc++.h>
using namespace std;

int p = 0;

void gcd(int x,int y){
  p++;
  if(y == 0){
    cout<<x<<' '<<p-1<<endl;
    return;
  }

  gcd(y,x%y);
}

int main(){

while(1){
  int x,y;
  cin >> x >> y;
  if(x == 0 && y == 0)break;
  gcd(x,y);
  int p = 0;
  //cout << x << " " << p-1 << endl;
  //int tmp =gcd(x,y,p);
  //cout <<  tmp << " " << p << endl;
}
  return 0;
}

