#include <iostream>

using namespace std;

int Euclid(int a, int b, int& step)
{
	if(b == 0)
	{
		return(a);
	}
	else
	{
		++step;
		return(Euclid(b, a % b, step));
	}
}

void solve()
{
	int a, b;
	while(cin >> a >> b, a || b)
	{
		int step = 0;
		cout << Euclid(a, b, step);
		cout << " " << step << endl;
	}
}

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