#include <iostream>
using namespace std;
int main(){
	long long unsigned int x,y,i;
	while(1){
		cin>> x >> y;
		if(x+y==0)break;
		if(x<y){
			int tmp=x;
			x=y;
			y=tmp;
		}
		int counter=0;
		while(y!=0){
			x=x%y;
			int tmp=y;
			y=x;
			x=tmp;
			counter++;
		}
		cout << x <<" "<<counter<<endl;
	}
}