#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>

using namespace std;


long long int yuku(long long int x,long long int y){
	long long int t=x%y;
	x=y;
	y=t;
	if(y==0)return x;
	else yuku(x,y);


};
long long int yu(long long int x,long long int y,long long int sum){
	long long int t=x%y;
	x=y;
	y=t;
	sum++;
	if(y==0)return sum;
	else yu(x,y,sum);


};
 
int main(){

long long int x,y;
while(1){
cin>>x>>y;if(x==y&&x==0)break;
long long int R=yuku(x,y);
long long int sum=0;
sum=yu(x,y,sum);

cout<<R<<" "<<sum<<endl;
}
return 0;
}