#include<iostream>
using namespace std;
int main(){
  long long int x,y,a,b;
  while(1){
    cin>>x>>y;
    if(x==0 && y==0)break;
    b=0;
    while(1){
      if(y==0)break;
      a=x%y;
      x=y;
      y=a;
      b++;
    }
    cout<<x<<" "<<b<<endl;
  }
  return 0;
}