#include <iostream>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		if(!a&&!b)break;
		int x=(a>=b)?a:b,y=(a>=b)?b:a,step=0,tmp;
		while(y!=0){
			x=x%y;
			tmp=x;
			x=y;
			y=tmp;
			++step;
		}
		cout<<x<<" "<<step<<"\n";
	}
	return 0;
}