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

int main(){
    long int cnt;
    unsigned long long a,b;
    unsigned long long x,y,q,r;
    while(1){
        cnt = 0;
        cin >> x >> y;
        if(x == 0 && y == 0) break;
        y = min(x,y);
        x = max(x,y);
        a = x;
        b = y;
        while(1){
            q = x/y;
            r = x -q*y;
            cnt++;
            if(r == 0) break;
            x = y;
            y = r;
        }
        cout << y << " " << cnt << endl;
    }
}