#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a, b;
    while (cin >> a >> b, a) {
        if (a < b) swap(a, b);
        int res = 0;
        while (b != 0) {
            int r = a % b;
            a = b;
            b = r;
            res++;
        }
        cout << a << " " << res << endl;
    }
    return 0;
}