#include<iostream>
#include<cstdio>
using namespace std;

typedef long long ll;

int ct=0;

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

int main(){
	int x,y;
	while(1){
		scanf("%d%d",&x,&y);
		if(x==0 && y==0)break;
		if(x<=y){
			int tmp=x;
			x=y;
			y=tmp;
		}
		ct=0;
		int ans=gcd(x,y);
		cout<<ans<<" "<<ct<<endl;
	}
	return 0;
}