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