#include <iostream>
#include <algorithm>

using namespace std;

int gcd( int x, int y, int &t)
{
	t = 0;
	int a = 0;

	if( x < y ) swap( x,y );

	while( y != 0 ){
		a = x % y; x = y; y = a;t++;
	}

	return x;
}

int main(int argc, char const* argv[])
{
	int x,y;

	while( cin >> x >> y && x != 0 )
	{
		int t;
		int a = gcd ( x, y ,t );

		cout << a << " " << t << endl;
	}
	return 0;
}