#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    int x, y;
    while(cin >> x >> y && x)
    {
        int ans = 0;
        if(x<y) swap(x,y);

        while(y)
        {
            x = x % y;
            swap(x,y);
            ans += 1;
        }
        cout << x << " " << ans << endl;

    }
    return 0;
}