#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

bool solve() {
    int a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) { return false; }
    if (a < b) { swap (a, b); }

    int step = 0;
    while (b > 0) {
        ++step;
        int t = a % b;
        a = b;
        b = t;
    }
    cout << a << ' ' << step << endl;
    return true;
}

int main() {
    while(solve());
    return 0;
}