#include<iostream>
using namespace std;

int main(){
	while(1){
		unsigned int a, b;
		cin >> a >> b;
		if(a == 0 && b == 0) break;
		int ans = 0;
		while(b != 0){
			int temp = a;
			a = b;
			b = temp % b;
			ans++;
		}
		cout << a << ' ' << ans << endl;
	}
	
	return 0;
}