#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
using namespace std;
int main(){
  int a,b;
  while(cin>>a>>b,a!=0){
    int c=0;
    if(b==a){
     cout<<a<<" "<<1<<endl;
     goto at;
   }
   int x,y;
   if(a>b){
     x=a,y=b;
   }else{
     x=b,y=a;
   }
   while(y>0){
     x=x%y;
     int s=x;
     x=y;
     y=s;
     c++;
   }
   cout<<x<<" "<<c<<endl;
 at:;
 }
 return 0;   
}
  