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

