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

int ans;
int gcd(int a, int b) {
	ans++;
	return a % b == 0 ? b : gcd(b, a % b);
}

int main() {
	int a, b;
	while(cin >> a >> b, a || b) {
		ans = 0;
		if(a < b)
			swap(a, b);
		int c;
		c = gcd(a,b);
		cout << c << " " << ans << endl;
	}
}