#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll s;

ll gcd(ll x, ll y) {
    if (x < y) swap(x, y);
    x %= y;
    swap(x, y);
    s++;
    return y ? gcd(x, y) : x;
}

int main() {
    ll a, b;
    while (cin >> a >> b && !(a == 0 || b == 0)) {
        s = 0;
        ll g = gcd(a, b);
        cout << g << ' ' << s << endl;
    }
}
