#include <iostream>
using namespace std;
int N;

int gcd(int a, int b){
	if(b == 0)
		return a;
	else{
		N++;
		return gcd(b, a % b);
	}
}

int main() {
	int x, y;
	while(cin >> x >> y && (x || y)){
		N = 0;
		int a = max(x, y);
		int b = min(x, y);
		int ans = gcd(a, b);
		
		cout << ans << " " << N << endl;
	}
	return 0;
}