#include <iostream>
#include <algorithm>
using namespace std;

int main()
{	
	long long x, y;

	cin >> x >> y;

	while (x > 0 || y > 0) {
		int i = 0;

		if (x < y)
			swap(x, y);

		while (y > 0) {
			x = x % y;
			swap(x, y);
			i++;
		}

		cout << x << " " << i << endl;

		cin >> x >> y;
	}
	
	return 0;
}

