#include <iostream>

using namespace std;

int main(int argc, char** argv)
{
	int n, m;
	int x, y, d, c;

	while(cin >> n >> m, n || m)
	{
		if(n >= m)
		{
			x = n;
			y = m;
		}
		else
		{
			x = m;
			y = n;
		}

		c = 0;
		while(y != 0)
		{
			d = x % y;
			x = y;
			y = d;
			c++;
		}

		cout << x << " " << c << endl;
	}

	return 0;
}