#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    long long x,y;
    while(cin>>x>>y){
        int i=0;
        if(x==0&&y==0) break;
        if(x<y) swap(x,y);
        while(1){
            x=x%y;
            swap(x,y);
            i++;
            if(y==0){
                cout<<x<<" "<<i<<endl;
                break;
            }
        }
    }
    return 0;
}