#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int X,Y,cnt;
	while(cin >> X >> Y, (X||Y))
	{
		cnt = 0;

		if(X<Y) swap(X,Y);
		while(Y!=0)
		{
			cnt++;
			X%=Y;
			swap(X,Y);
		}

		cout << X << " " << cnt << endl;
	}

	return 0;
}