#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int x, y;
	while (cin >> x >> y){
		if (x == 0 && y == 0)break;
		if (x < y)swap(x, y);
		int sum = 0;
		do{
			x = x%y;
			swap(x, y);
			sum++;
		} while (y != 0);
		cout << x << ' ' << sum << endl;
	}
	return 0;
}