#define _USE_MATH_DEFINES
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<climits>
using namespace std;

int cnt;

int gcd(int a, int b){
	if(b == 0) return a;
	cnt++;
	return gcd(b, a%b);
}

int main(){
	int X, Y;
	while(cin >> X >> Y, X || Y){
		if(X < Y) swap(X, Y);
		cnt = 0;
		int ans = gcd(X, Y);
		printf("%d %d\n", ans, cnt);
	}
	return 0;
}