#include<stdio.h>
int main(void)
{
	long long int a,s,d,f,g,h,j,i;
	while(1){
		f=0;	
		scanf("%lld %lld",&a,&s);
		if(a==0&&s==0){
			break;
		}
		if(a<s){
			d=s;
			s=a;
			a=d;
		}
		while(1){
			if(s==0){
				break;
			}
			a=a%s;
			d=s;
			s=a;
			a=d;
			f++;
		}
		printf("%lld %lld\n",a,f);
	}
	return 0;
}