#include<iostream>
using namespace std;
int main(){
	int x,y;
	while(cin>>x>>y,x|y){
		if(x<y)swap(x,y);
		int count=0;
		while(y){
			x%=y;
			swap(x,y);
			count++;
		}
    cout<<x<<" "<<count<<endl;
	}
	return 0;
}