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

int main(){
    int cnt;
    int x,y,a;
    while(1){
        cnt = 0;
        cin >> x >> y;
        if(x == 0 && y == 0) break;
        if(x < y) swap(x,y);
        while(y!=0){
            x %= y;
            a = x;
            x = y;
            y = a;
            cnt++;
        }
        cout << x << " " << cnt << endl;
    }
}