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