#include <iostream>
#include <algorithm>

using namespace std;

pair<int, int> euc_gcd(int a, int b){

    int c, step = 0;

    if(a < b){
        swap(a, b);
    }

    while(b > 0){
		step++;
        c = a % b;
        a = b;
        b = c;
    }

    return make_pair(a, step);
}

int main(){

	int a, b;

	while(cin>>a>>b, (a||b)){
		
		pair<int, int> t = euc_gcd(a, b);
		cout << t.first << " " << t.second << endl;
	}

	return 0;
}