#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

int main()
{
    ll x, y, step;
    
    while(cin >> x >> y && x && y) {
        if(x < y) swap(x, y);
        step = 0;
        do {
            x = x % y;
            swap(x, y);
            step++;
        } while(y != 0);
        cout << x << " " << step << endl;
    }
    return 0;
}