#include <iostream>
using namespace std;
int main(void){
    int x, y, a, i, r;
    cin >> x >> y;
    while(x != 0 || y != 0){
        i = 0;
        
        if(y > x){
            a = x;
            x = y;
            y = a;
        }

        while(y != 0){
            r = x % y;
            x = r;
            r = y;
            y = x;
            x = r;
            i++;
        }
        
        cout << x << " " << i << endl;
        cin >> x >> y;
    }
    
}

