#include<iostream>
#include<algorithm>
using namespace std;
int s,a,b;
int gcd(int x,int y){
	x=x%y; swap(x,y); s++;
	return y?gcd(x,y):x;
}
int main(){
	while(cin>>a>>b,a){
		s=0;
		if(a<b)swap(a,b);
		cout<<gcd(a,b)<<" "<<s<<endl;
	}
	return 0;
}