#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	long long a,b;
	while(cin>>a){
		cin>>b;
		if(a==0&&b==0)break;
		long long cnt=0;
		while(b!=0){
			a=a%b;
			swap(a,b);
			cnt++;
		}
		cout<<a<<" "<<cnt<<endl;
	}
	return 0;
}