#include <iostream>
using namespace std;
int main(void){
	for (int i = 0; i < 1000; i++){
		int a,b;
		cin >> a >> b;

		if (a == 0 && b == 0)
			break;

		int j,r,COUNT = 1;

		if (b > a){
			j = a;
			a = b;
			b = a;
		}

		while((r = a % b) != 0)
			{ a = b; b = r; COUNT++;}

		cout << b << " " <<COUNT << endl;
	}

	return 0;
}

