#include<stdio.h>
int main(void)
{
	int x,y,temp,X,e,cnt;
	while(1){
		cnt=0;
		scanf("%d %d",&x,&y);
		if(x==0&&y==0)break;
		while(1){
			cnt++;
			X=x%y;
			x=y;
			y=X;
			if(y==0)break;
		}
		printf("%d %d\n",x,cnt);
	}
	return 0;
}	