#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	long long X,Y,s,c=0;
	while(cin>>X>>Y){
		if(X==0 && Y==0) break;
		while(Y!=0){
			s = X % Y;
			X = s;
			swap(X,Y);
			c++;
		}
	cout<<X<<" "<<c<<endl;
	c=0;
	}
}