#include <iostream>
using namespace std;

int main() {
    while (true) {
        int x, y;
        cin >> x >> y;
        if (x == 0 && y == 0) {
            break;
        }
        if (x < y) {
            int temp = x;
            x = y;
            y = temp;
        }
        int count = 0;
        while (y > 0) {
            int temp = x % y;
            x = y;
            y = temp;
            count++;
        }
        cout << x << " " << count << endl;
    }
}