#include<bits/stdc++.h>
using namespace std;
main(){
  int x,y,w,c,a,b;
  while(1){
    c=0;
    cin>>a>>b;
    if(a==0&&b==0){
      break;
    }
    x=max(a,b);
    y=min(a,b);
    while(y){
      x=x%y;
      int temp;
      temp=x;
      x=y;
      y=temp;
      c++;
    }
    cout<<x<<" "<<c<<endl;
  }
}
    