#include<iostream>
using namespace std;

int main(){
	int x,y;
	while(cin >> x >> y){
		if(x == 0 && y == 0) break;
		int cnt=0;
		if(x < y){
			x^=y;
			y^=x;
			x^=y;
		}
		while(y){
			x %= y;
			if(x < y){
				x^=y;
				y^=x;
				x^=y;

				cnt++;
			}
		}
		cout << x << " " << cnt << endl;
	}
}