#include <iostream>
#include <algorithm>
using namespace std;

int gcd(int x,int y,int& step){
	int n = 0;
	if( x < y ) swap( x , y );

	do{
		x = x % y;
		swap( x , y );
		n++;
	}while( y != 0 );
	step = n;
	return x;
}

int main(){
	int a,b,n;

	while( cin >> a >> b , a && b ){
		int ans = gcd(a,b,n);
		cout << ans << " " << n << endl;
	}
}