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