#include<stdio.h>

int main(){
	int x,y,count,t;
	while(0<=scanf("%d%d",&x,&y)){
		if(x==0 && y==0)break;
		if(x<y){
			count=x;
			x=y;
			y=count;
		}
		count=0;
		while(y!=0){
			x=x%y;
			t=x;
			x=y;
			y=t;
			++count;
		}
		printf("%d %d\n",x,count);
	}
	return 0;
}