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

int main() {
    int X, Y;
    while (cin >> X >> Y, (X || Y)) {
        if (X < Y) swap(X, Y);
        int cnt = 0;
        while (Y != 0) {
            X = X % Y;
            swap(X, Y);
            cnt ++;
        }
        cout << X << " " << cnt << endl;
    }
    return 0;
}