#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int x, y, tmp, c;
	
	while(1){
		cin >> x >> y;
		if(x == 0 && y == 0){
			break;
		}
		c = 0;
		if(x < y){
			tmp = x;
			x = y;
			y = tmp;
		}
		
		while(y > 0){
			tmp = x % y;
			x = y;
			y = tmp;
			c++;
		}
		
		cout << x << " " << c << endl;
	}
	
	return 0;
}