#include <iostream>
#include <vector>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int ans;

void gcd(int x,int y)
{
	ans++;
	x = x % y;
	swap(x,y);

	if(y == 0)
	{
		cout << x << " " << ans << endl;
		return;
	}
	else gcd(x,y);
}

int main()
{
	int a,b;
	while(cin >> a >> b)
	{
		if(a == 0 && b == 0) break;

		ans = 0;

		if(a < b) swap(a,b);
		gcd(a,b);	
	}
	return 0;
}