#include<iostream>

using namespace std;

typedef long long ll;

int ct=0;

int gcd(ll a,ll b){
	if(b==0)return a;
	ct++;
	return gcd(b,a%b);
}

int main(){
	ll x,y;
	while(1){
		cin >> x >> y;
		if(x==0 && y==0)break;
		if(x<y){
			ll tmp=x;
			x=y;
			y=tmp;
		}
		cout<<gcd(x,y)<<" "<<ct<<endl;
		ct=0;
	}
	return 0;
}