#include <iostream>
#include <algorithm>

using namespace std;

int ret;

int gcd(int n, int m){
	if(n < m) swap(n,m);
	if(m == 0) return n;
	ret++;
	return gcd(m,n%m);
}

int main(void){
	int n,m;
	while(cin >> n >> m){
		if((n|m) == 0) break;
		ret = 0;
		cout << gcd(n,m) << " ";
		cout << ret << endl; 
	}
}