#include<iostream>
#include<algorithm>
using namespace std;

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