#include <iostream>
using namespace std;

int count;

int gcd(int m,int n)
{
	if(n == 0)
		return m;
	count++;
	int tmp = m%n;
	return gcd(n,tmp);
}

int main()
{
	int m,n;
	while(cin >> m >> n){
		count = 0;
		if(m==0 && n==0)
			break;
		cout << gcd(m,n);
		cout << " " << count << endl;
	}
	return 0;
}