#include <cstdio>

using namespace std;

int main()
{
    while( 1 )
    {
        int num1 = 0, num2 = 0;
        scanf( "%d %d\n", &num1, &num2 );
        if( num1 == 0 && num2 == 0 )break;
        int cnt = 0;
        while( num2 != 0 )
        {
            int index = num2;
            num2 = num1 % num2;
            num1 = index;
            cnt++;
        }
        printf( "%d %d\n", num1, cnt );
    }
    return 0;
}
