#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

int depth;

long long int GCD(long long int a, long long int b){
	depth++;
	long long int rest = a % b;
	a = rest;
	swap(a, b);
	if(b == 0){
		return a;
	}
	return GCD(a, b);
}

int main(){
	
	long long int a, b;
	
	while(true){
		
		cin >> a >> b;
		
		if(a == 0 && b == 0){
			break;
		}
		
		depth = 0;
		
		if(a < b){
			swap(a, b);
		}
		
		long long int ans = GCD(a, b);
		
		cout << ans << " " << depth << endl;
		
	}
	
	return 0;
}