#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

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