#include <cstdio>
using namespace std;

void greatestCommonDivisor(int x, int y);

int main(){
	int a, b;
	while(scanf("%d %d", &a, &b)){
		if(a == 0 and b == 0) break;
		greatestCommonDivisor(a, b);
	}
	return 0;
}

void greatestCommonDivisor(int x, int y){
	int temp, count = 0;
	while(true){
		x %= y;
		temp = x;
		x = y;
		y = temp;
		if(y == 0) break;
		count++;
	}
	printf("%d %d\n", x, count + 1);
}