#include<iostream>

int c;

int gcd(int x, int y){
	c++;
	if(y==0)
		return --c-c+x;
	return gcd(y, x%y);
}

int main(){
	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;
	}
}