#include<stdio.h>

int main(){
	int a,b;
	while(1){
		scanf("%d%d",&a,&b);
		if(!(a|b))return 0;
		int now=0;
		if(a<b){
			int c=a;
			a=b;
			b=c;
		}
		while(b!=0){
			a=a%b;
			int c=a;
			a=b;
			b=c;
			now++;
		}
		printf("%d %d\n",a,now);
	}
}