#include <iostream>
using namespace std;

int main(){
	int x, y, tmp, count;
	while(cin>>x>>y, x&&y){
		if(x<y){
			tmp=x;
			x=y;
			y=tmp;
		}
		count=0;
		while(y!=0){
			x %= y;
			tmp=x;
			x=y;
			y=tmp;
			count++;
		}
		printf("%d %d\n", x, count);
	}
	return 0;
}
