#include <bits/stdc++.h>
using namespace std;

void swap(unsigned int *a, unsigned int *b){
	if(*a != *b){
		*a ^= *b;
		*b ^= *a;
		*a ^= *b;
	}
}

int main(){
	unsigned int a, b, cnt;
	
	while(cin >> a >> b, a){
		if(a < b) swap(&a, &b);
		cnt = 0;
		while(b != 0){
			a = a % b;
			swap(&a, &b);
			++cnt;
		}
		cout << a << " " << cnt << endl;
	}
	
	return 0;
}