#include<iostream>
#include<string>
using namespace std;
int main(){
	long long x,y;
	while(true){
	cin>>x>>y;
	if(x==0&&y==0)
		break;
	int i=1;
	while(true){
		x%=y;
		int tmp=x;
		x=y;
		y=tmp;
		if(y==0)
			break;
		i++;
	}
	cout<<x<<" "<<i<<endl;
	}
    return 0;
}