#include <iostream>
using namespace std;
int main(){
	int a, b;
	while(cin >> a >> b) {
		if(a==0&&b==0) break;
		int cnt = 0;
		if(a<b) swap(a,b);
		while(b) {
			int t = a/b;
			swap(a-=b*t,b);
			cnt++;
		}
		cout << a << " " << cnt << endl;
	}
}