#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
	while(true)
	{
		int x = 0, y = 0, count = 0;;

		cin >> x >> y;

		if(x == 0 && y == 0)
		{
			return false;
		}

		if(x < y)
		{
			swap(x, y);
		}

		for(count = 0; y != 0; count++)
		{
			x = x % y;

			swap(x, y);
		}

		cout << x << ' ' << count << endl;
	}
}