#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

struct GCD{
	int gcd;
	int step;
};

GCD calc_gcd (int a, int b )
{
	GCD res;
	
	int step = 0;

	while(1){
		++step;
		if (a % b == 0){
			break;
		} // end if
		a = a % b;
		if (a < b ){
			swap (a, b );
		} // end if
//		cout << "a: " << a << " b: " << b << endl;
	} // end while

	res.gcd = b;
	res.step = step;

	return res;
}	

int main()
{
//	cut here before submit 
//	freopen("testcase.ea", "r", stdin);
	string str = "";

	while (getline (cin, str ) ){
		int a, b;
		stringstream ss (str );
		ss >> a >> b;

		if (a == 0 && b == 0){
			break;
		} // end if
		GCD res;

//		cout << "a: " << a << " b: " << b << endl;

		if (a < b ){
			swap (a, b );
		} // end if

		res = calc_gcd (a, b );
		cout << res.gcd << ' ' << res.step << endl;

	} // end loop

		
	return 0;
}