/*
 * src.cpp
 *
 *  Created on: 2016/07/27
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

int main(){
	int x,y;
	do{
		cin>>x>>y;
		if (x || y){
			int ans=0;
			if (x<y) swap(x,y);
			while(y){
				x%=y;
				swap(x,y);
				ans++;
			}
			cout<<x<<" "<<ans<<endl;
		}
	}while (x || y);
	return 0;
}