#include <iostream>
using namespace std;
int main()
{
	int x, y, c;
	while (cin >> x >> y && x && y)
	{
		if (x < y) swap(x, y);
		c = 0;
		while (y > 0)
		{
			x %= y;
			swap(x, y);
			c++;
		}
		cout << x << " " << c << endl;
	}
}