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

int main()
{
	vector<int>a(2);
	while (1) 
	{
		vector<int>a(2);
		cin >> a[1] >> a[0];
		if (a[0] == 0 && a[1] == 0)break;
		int o = 0;
		sort(a.begin(), a.end());
		while (1)
		{
			sort(a.begin(), a.end());
			if (a[1] % a[0] == 0)break;
			a[1] = a[1] % a[0];
			o++;
		}
		cout << a[0]<<" "<<o+1<<endl;
	}
}