#include <iostream>
using namespace std;
int main()
{

	int x,y;

	while(true){
		int z=0;
		int c=0;

		cin >> x >> y;
		if(x==0 && y==0)
			break;

		while(true){
			x = x % y;
			z = x;
			x = y;
			y = z;

			c++;			

			if(y==0)
				break;
		}

		cout << x << ' ' << c << endl;
	}
	return 0;
}