#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
//#define int long long
using namespace std;

int X, Y;

pair<int, int> gcd_count(int X, int Y)
{
	int count = 0;

	do
	{
		X = X % Y;
		swap(X, Y);
		count++;
	} while (Y != 0);

	return make_pair(X, count);
}

signed main()
{
	while (true)
	{
		cin >> X >> Y;
		if (X == 0 && Y == 0) break;

		if (X < Y) swap(X, Y);
		pair<int, int> ans = gcd_count(X, Y);
		
		cout << ans.first << " " << ans.second << endl;
	}
}