#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,f,g,h,j,i,k;
	while(1){
		scanf("%d %d",&a,&s);
		if(a==0&&s==0) break;
		f=0;
		g=a;
		h=s;
		if(a<s){
			g=s;
			h=a;
		}
		while(1){
			d=g%h;
			g=d;
			d=h;
			h=g;
			g=d;
			f++;
			if(h==0) break;
		}
		printf("%d %d\n",g,f);
	}
	return 0;
}