#include <cstdio>

using namespace std;

int t, r;

int gcd( int x, int y )
{
    if( x == 0 ) return y;
    if( y == 0 )return x; t++;
    if( y < x ) return gcd( y, x % y );
    return gcd( x, y % x );
}

int main()
{
    while( 1 )
    {
        int num1 = 0, num2 = 0;
        scanf( "%d %d\n", &num1, &num2 );
        if( num1 == 0 && num2 == 0 )break;
        t = 0;
        r = gcd( num1, num2 );
        printf( "%d %d\n", r, t );
    }
    return 0;
}
