#include <iostream>
#include <algorithm>

using namespace std;

int ct;

int GCD(int m, int n);

int main()
{
	int m, n;
	
	while (cin >> m >> n, m, n){
		ct = 1;
		if (m < n){
			swap(m, n);
		}
		int gcd = GCD(m, n);
		cout << gcd << ' ' << ct << endl;
	}
	
	return (0);
}

int GCD(int m, int n)
{
	int r;
	
	while (m % n != 0){
		r = n;
		n = m % n;
		m = r;
		ct++;
    }
	
	return (n); 
}