#include <iostream>
using namespace std;

void swap(int* a, int* b);

void swap(int* a, int* b){
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

int main(){
    int x, y;
    while(cin >> x >> y, x != 0 || y != 0){
        int cnt = 0;
        if(x < y) swap(&x, &y);
        while(y != 0){
            x = x % y;
            swap(&x, &y);
            cnt++;
        }
        cout << x << " " << cnt << endl;
    }
    return 0;
}