#include<iostream>

unsigned int c;

unsigned int gcd(unsigned int X, unsigned int Y){
	unsigned x, y;
	if(Y > X)
		x = Y, y = X;
	else
		x = X, y = Y;
	x = x%y;
	unsigned tmp = x;
	x = y;
	y = tmp;
	c++;
	if(y == 0)
		return x;
	return gcd(x, y);
}

int main(){
	unsigned int x, y;
	while(true){
		c = 0;
		std:: cin >> x >> y;
		if(x == 0 && y==0)
			return 0;
		std:: cout << gcd(x, y) << ' ' << c << std::endl;
	}
}