#include <cstdio>
#include<iostream>
#include <iomanip>

using namespace std;

void Euclidean(int a,int b,int n){
	if(b!=0) Euclidean(b,a%b,n+1);
	else cout<<a<<" "<<n<<endl;
	return;
}

int main(void){

	int a,b;

	while(1){

		cin>>a>>b;
		if(a==0&&b==0) break;
		Euclidean(a,b,0);
	}

    return 0;
}