#include<iostream>

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