#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pp = pair<ll,ll>;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)
//fixed << setprecision(20)

int main(){
	ll a,b;
	while(true){
		cin >> a >> b;
		if(a == 0 && b == 0)break;
		ll x = max(a,b);
		ll y = min(a,b);
		int count = 0;
		while(y != 0){
			x = x % y;
			ll t = x;
			x = y;
			y = t;
			count++;
		}
		cout << x << " " << count << endl;
	}
	return 0;
} 
