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