#include<iostream>
using namespace std;

int main()
{
	int x,y,temp,step;
	cin>>x>>y;

	while(x!=0){
		if(x-y<0){
			temp=x;
			x=y;
			y=temp;
		}
		step=1;
		for(;;){
			x=x%y;
			temp=x;
			x=y;
			y=temp;
			if(y==0)break;
			step++;
		}
		cout<<x<<" "<<step<<"\n";
		cin>>x>>y;
	}
	return 0;
}

		