#include<iostream>
using namespace std;

int main()
{
    int a, b;

    while( cin >> a >> b )
    {
        if( a == 0 && b == 0 )
            break;
        int c = 0;
        if( a < b )
        {
            int temp = a;
            a = b;
            b = temp;
        }
        while( b != 0 )
        {
            int temp = b;
            b = a % b;
            a = temp;
            c++;
        }
        cout << a << " " << c << endl;
    }

    return 0;
}

