#include <iostream>

using namespace std;

int take;

int gcd(int n, int m)
{
    take++;
    if (m == 0)
        return n;
    return gcd(m, n % m);
}

int main()
{
    int n, m, ans;

    while (cin >> n >> m, n || m) {
        take = 0;
        ans = (n >= m) ? gcd(n, m) : gcd(m, n);

        cout << ans << " " << take - 1 << endl;
    }

    return 0;
}