#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

int gcd(int a, int b, int & step){
    return b ? step++, gcd(b, a%b, step) : a;
}

int main(int argc, char ** argv) {
    int a, b;
    while (scanf("%d%d", &a, &b), a != 0){
        if (a < b) swap(a, b);
        int g, k = 0;
        g = gcd(a, b, k);
        printf("%d %d\n", g, k);
    }
}