#include <bits/stdc++.h>
using namespace std;

using ll = long long;

ll gcd(ll a, ll b, int& cnt) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b, ++cnt);
}

//ll lcm(ll a, ll b) {
//    int g = gcd(a, b);
//    a /= g;
//    b /= g;
//    return a * b * g;
//}

int main() {
    int a, b;
    while(cin >> a >> b, a) {
        int cnt = 0;
        if(a < b) {
            swap(a, b);
        }
        int res = gcd(a, b, cnt);
        cout << res << ' ' << cnt << endl;
    }
}
