#include <iostream>
using namespace std;

int main() {
	int a,b;
	
	while(cin >> a >> b){
		if(a == 0 && b == 0) break;
		int count = 0;
		if(b<a){
			int temp = b;
			b = a;
			a = temp;
		}
		while(a != 0){
			int temp = a;
			a = b%a;
			b = temp;
			count++;
		}
		cout << b << " " << count << endl; 
	}
	return 0;
}
