#include <stdio.h>
int X, Y, T, R;
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() {
	while(true) {
		scanf("%d%d", &X, &Y); T = 0;
		if(X == 0 && Y == 0) break;
		R = gcd(X, Y);
		printf("%d %d\n", R, T);
	}
	return 0;
}

