#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b;
	while (cin >> a >> b&&a != 0) {
		if (a < b)swap(a, b);
		int num = 0;
		while (b) {
			a %= b;
			swap(a, b);
			++num;
		}
		cout << a << ' ' << num << endl;
	}
	return 0;
}