#include <cstdio>
#include <algorithm>
int ans = 0;
int GCD(int a, int b){
	if(b==0)return a;
	ans++;
	return GCD(b, a%b);
}

int main(){
	int x, y;
	while(scanf("%d %d",&x, &y), x+y){
		ans = 0;
		if(x < y)std::swap(x,y);
		int gcd = GCD(x, y);
		printf("%d %d\n", gcd, ans);
	}
}