#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
    long long int a,b,x,y,z,st;
     
    while(cin >> a >> b,a,b){
        x=max(a,b);
        y=min(a,b);
        st=0;
        while(1){
            if(y==0) break;
            z=x%y;
            x=y;
            y=z;
            st++;
        }
        cout << x << ' ' << st << endl;
    }
     
    return 0;
}