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

int main(){
	while(1){
	int a,b,c;
	cin>>a>>b;
	if(a==0 && b==0){break;}
	c=0;
	int count=0;
	while(b!=0){
	c=a%b;
	a=c;
	swap(a,b);

	count++;
	}
	cout<<a<<" "<<count<<endl;
	}
}
