#include<stdio.h>
int main(void)
{
	int a,b,x,c;
	while(1){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0) break;
		if(a<b){
			x=a; a=b; b=x;
		}
		c=0;
		while(b!=0){
			a=a%b; x=a; a=b; b=x; c++;
		}
		printf("%d %d\n",a,c);
	}
	return 0;
}