#include <iostream>
using namespace std;

int main() {
	int x,y,y1,z,s;
	while(cin >> x >> y) {
		if (x==0 && y==0) break;
		if (x<y) { z=x; x=y; y=z;}
		s=y1=0; 
		while(y!=0){ z=x % y; y1=y; x=y; y=z; s++;}
		cout << y1 << ' ' << s << endl;
	}
	return 0;
}