#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1001001001;

pii gcd(int a, int b)
{
	if(b == 0)
		return pii(a, 0);
	pii ret = gcd(b, a%b);
	ret.second++;
	return ret;
}

int main()
{
	int a, b;
	while(scanf("%d%d", &a, &b), a){
		if(a < b)
			swap(a, b);
		pii ret = gcd(a, b);
		printf("%d %d\n", ret.first, ret.second);
	}
}