#include<iostream>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)


using namespace std;

int cnt;

int lcd(int a, int b){
	if (a < b) swap(a, b);
	int c;
	cnt=0;

	while (b != 0){
		c = a%b;
		a = b;
		b = c;
		cnt++;
	}
	return a;
}



int main(){

	int a, b;
	while (cin >> a >> b && a != 0 && b != 0){
		int res = lcd(a,b);
		cout << res << " " << cnt << endl;
	}
}