#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;
const int MAX = 10000;
typedef pair<int, int> P;
/** Problem0197 : Greatest Common Divisor : Euclidean Algorithm **/
int main()
{
	int a, b;
	
	while (cin >> a >> b, a!=0 && b!=0) {
		int i=0;
		while (1) {
			if (a < b)
				swap(a, b);
			a = a%b;
			i++;
			
			if (a==0)
				break;
			
		}
		cout << b << " " << i << endl;
	}
}