#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int x, y;
        cin >> x >> y;
        if(x == 0)
            return 0;
        if(x < y)
            swap(x, y);

        int ret = 0;
        do{
            ++ ret;
            x %= y;
            swap(x, y);
        }while(y != 0);

        cout << x << ' ' << ret << endl;
    }
}