#include<stdio.h>
int main(void)
{
	int x,y;
	int cnt;
	int temp;

	scanf("%d %d",&x,&y);
	while(x!=0 && y!=0){
		cnt=0;
		if(x<y){
			temp=x;
			x=y;
			y=temp;
		}
		while(y!=0){
			x=x%y;
			temp=x;
			x=y;
			y=temp;
			cnt++;
		}
	printf("%d %d\n",x,cnt);
	scanf("%d %d",&x,&y);
	}
	return 0;
}