#include <iostream>
using namespace std;

int gcd(int a, int b, int step);

int main()
{
	int a, b;

	while (cin >> a >> b, a){
		int step = 0;
		gcd(a, b, step);
	}

	return (0);
}

int gcd(int a, int b, int step)
{
	if (b == 0){
		cout << a << " " << step << endl;
	}
	else if (a < b){
		return (gcd(a, b % a, step + 1));
	}
	else {
		return (gcd(b, a % b, step + 1));
	}
}