#include<iostream>
using namespace std;

int main() {
	int a, b;
	while (cin >> a >> b,a,b) {
		int s = 0;

		if (a < b) { swap(a, b); }
		while (b!=0) {
				int c = a%b;
				a = b;
				b = c;
				s++;			
		}
		cout << a << ' ' << s << endl;
	}
	return 0;
}