#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	while (1) {
		long long a, b, count = 0;
		cin >> a >> b;
		if (a == 0 && b == 0) return 0;
		if (a < b) swap(a, b);
		while (1) {
			count++;
			a = a%b;
			swap(a, b);
			if (b == 0) {
				cout << a << " " << count << endl;
				break;
			}
		}
	}
	return 0;
}