#include<iostream>
using namespace std;

int main(){
	int a,b;
	while(1){
		cin>>a>>b;
		if(a==0 && b==0)break;
		int cnt=0;
		if(a<b){
			int sub=a;
			a=b;
			b=sub;
		}
		while(1){
			int alt=a%b;
			cnt++;
			a=b;
			b=alt;
			if(b==0)break;
		}
		cout<<a<<" "<<cnt<<endl;
	}
	return 0;
}