#include <cstdio>
#include <algorithm>

using namespace std;

int step;

int gcd(int x, int y)
{
	if (x < y) swap(x, y);
	if (y == 0) return (x);
	step++;
	return (gcd(y, x % y));
}

int main()
{
	int a, b;
	
	while (scanf("%d %d", &a, &b) && a){
		step = 0;
		int ans = gcd(a, b);
		printf("%d %d\n", ans, step);
	}
	return (0);
}