#include <iostream>
using namespace std;

int main(void){
    int a, b;
    int tmp;
    while(true){
        cin >> a >> b;
        if(a + b == 0) break;
        if(a < b){
            tmp = a;
            a = b;
            b = tmp;
        }

        //ユークリッドの互除法
        int r, c = 0; //余り、ステップ数
        while(true){
            r = a % b;
            c++;
            if(r == 0) break;
            a = b;
            b = r;
        }
        cout << b << " " << c << endl;
    }   
}

