#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	int x, y;
	while (1) {
		cin >> x >> y;
		if (x == 0 && y == 0)
			break;
		if (x < y)
			swap(x, y);
		int i=0;
		for (; y != 0; i++) {
			x %= y;
			swap(x, y);
		}
		cout << x << ' ' << i << endl;
	}
}
