#include <iostream>
using namespace std;
 
int main(){
int x,y,z,ans;
	while(true){
		ans=0;
		cin>>x>>y;
		if(x==0||y==0)break;
		if(x<y){
			z=x;
			x=y;
			y=z;
		}
		while(y!=0){
		x=x%y;
		z=x;
		x=y;
		y=z;
		ans++;
		}
		cout<<x<<' '<<ans<<endl;
	}
}	