#include <iostream>

using namespace std;

void GCD(int x, int y, int c)
{
	if(y == 0)
	{
		cout << x << " " << c << endl;
		return;
	}
	GCD(y, x % y, c + 1);
}

void solve()
{
	int x, y;
	while(cin >> x >> y, x || y)
	{
		if(x >= y)
		{
			GCD(x, y, 0);
		}
		else
		{
			GCD(y, x, 0);
		}
	}
}

int main()
{
	solve();
	return(0);
}