#include <iostream>

using namespace std;

void solve(int x, int y, int count) {
    int mod = x % y;
    if (mod == 0) {
        cout << y << ' ' << count << endl;
    } else {
        solve(y, mod, count+1);
    }
}

int main() {
    int x, y;
    while (cin >> x >> y) {
        if (x < y) {
            int tmp; tmp = x; x = y; y = tmp;
        }
        if (x == 0 && y == 0) break;
        solve(x, y, 1);
    }
    return 0;
}