#include <iostream>
using namespace std;
int main(void){
    int a,b;
	while(cin >> a >> b){
	if (a == 0 & b == 0)
		break;
	int r,COUNT = 1;
	while((r = a % b) != 0)
		{ a = b; b = r; COUNT++;}
	cout << b << " " <<COUNT << endl;
	}
	return 0;
}

