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