#include <bits/stdc++.h>

using namespace std;

int main(){
	int x, y, rest, cnt;

	while (cin >> x >> y, x) {
		if (x < y) {
			rest = x;
			x = y;
			y = rest;
		}
		cnt = 0;
		while(true) {
			++cnt;
			rest = x%y;
			if (rest == 0) {
				break;
			}
			x = y;
			y = rest;
		}
		cout << y << " " << cnt << endl;
	}

	return 0;
}
