#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int x,y;
	while(cin>>x){
		cin>>y;
		if(x==0&&y==0)break;
		int cnt=0;
		while(true){
			if(y==0)break;
			x=x%y;
			swap(x,y);
			cnt++;
		}
		cout<<x<<" "<<cnt<<endl;
	}
	return 0;
}
}