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

int c;

int gcd(int x,int y){
  if(x < y)swap(x,y);
  if(!y)return x;
  c++;
  return gcd(y,x%y);
}

int main(){
  int a,b;
  int ans;

  while(1){
    cin >> a >> b;
    if(!a && !b)break;

    c = 0;
    ans = gcd(a,b);
    cout << ans << " " << c << endl;
  }
}