#include <iostream>
using namespace std;
#include <algorithm>

int main(){

	int x, y;
	while (cin >> x >> y && x != 0 && y != 0){

		if (y > x) swap(x, y);
		int count = 0;
		while (y != 0){
			count++;
			x = x % y;
			swap(x, y);
		}

		cout << x << ' ' << count << endl;
	}
}