#include <iostream>
using namespace std;

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