#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    long long a, b, idx;
    for (; ;) {
        scanf("%lld %lld", &a, &b);
        if (a == 0 && b == 0) break;
        if (b > a) swap(a, b);
        idx = 1;
        while (a % b!= 0) {
            long long tmp = b;
            b = a % b;
            a = tmp;
            idx++;
        }
        printf("%lld %lld\n", b, idx);
    }
    return 0;
}

