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