#include <iostream>
using namespace std;

int main() {
	int a,b,c,w;
	while(cin>>a>>b,a!=0&&b!=0){
		if(b>a){w=a;a=b;b=w;}
		c=0;
		while(a!=0){
			c++;
			w=a;a=b%a;b=w;
		}
		if(c!=1)c--;
		cout<<b<<" "<<c<<endl;
	}
	return 0;
}