#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
int cnt(int x,int y)
{
	if(x < y) swap(x,y);
	if(y == 0) return 0;
	return cnt(y,x%y)+1;
}
int main()
{
	while(1)
	{
		int x,y;
		cin >> x >> y;
		if(x == 0 && y == 0) return 0;
		cout << __gcd(x,y) << " " << cnt(x,y) << endl;
	}
}