#include <iostream>
using namespace std;
//ユークリッドの互除法を再帰で解くプログラム

int gcd(int a,int b,int count){
    if(b != 0){
        gcd(b,a%b,count+1);
    }else{
        cout << a << " " << count << endl;
    }
    return 0;
}

int main(){
    int a,b;
    while (cin >> a >> b) {
        if (a == 0 && b == 0){
            break;
        }else{
            gcd(max(a,b),min(a,b),0);
        }
    }
    return 0;
}
