#include<cstdio>
#include<iostream>
using namespace std;
int main(void){
	int x,y,temp,cnt;
	while(1){
		cin>>x>>y;
		if(x+y==0)break;
		if(x<y){
			temp=x;
			x=y;
			y=temp;
		}
		cnt=0;
		while(1){
			x=x%y;
			temp=x;
			x=y;
			y=temp;
			cnt++;
			if(y==0) break;
		}
		cout<<x<<' '<<cnt<<endl;
	}
	return 0;
}