#include <bits/stdc++.h>
using namespace std;

int mygcd ( int a, int b, int &S ) {

    if ( b == 0 ) {
        return ( a );
    }
    S++;

    return ( mygcd ( b, a % b, S ) );

}
int main()
{
    int A, B;

    while ( cin >> A >> B, A || B ) {

        int S = 0;
        int div;

        if ( A < B ) {
            swap ( A, B );
        }

        div = mygcd(A, B, S);
        cout << div << " " << S << endl;
    }

    return ( 0 );
}

