#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

int c = 0;
long long int gcd(long long int l, long long int r) {

	assert(l > 0 && r > 0);
	if (l > r)return gcd(r, l);
	else {
		c++;
		const long long int num = r%l;
		if (num) {
			return gcd(l, num);
		}
		else {
			return l;
		}
	}
}

int main() {
	while (1) {
		int a, b; cin >> a >> b;
		if (!a)break;
		if (a > b)swap(a, b);
		c = 0;
		int agcd = gcd(a, b);
		cout << agcd << " " << c << endl;
	}
	return 0;
}