#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

static int c;
int gcd(int x, int y)
{
	if (y == 0)
		return x;
	++c;
	return gcd(y, x % y);
}	
int main()
{
	int x, y;
	while (scanf("%d %d", &x, &y), x | y)
	{
		if (x < y)
			swap(x, y);
		c = 0;
		int ans = gcd(x, y);
		printf("%d %d\n", ans, c);
	}

	return 0;
}