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