#include <bits/stdc++.h>
using namespace std;

int main(){
	long long int x,y,c;
	while(1){
		cin>>x>>y;
		if(x==0&&y==0) break;
		if(x<y) swap(x,y);
		c=0;
		int f=1;
		while(f){
			x%=y;
			swap(x,y);
			if(y==0) f=0;
			c++;
		}
		cout<<x<<" "<<c<<endl;
	}
	return 0;
}
