#include<iostream>
using namespace std;

void swap( int &a, int &b ){
	int tmp = a;
	a = b;
	b = tmp;
}

int main(){
	int a, b;
	while( cin >> a >> b, a||b ){
		if( a < b )
			swap(a,b);
		int c=0;
		for( ;b>0;c++ ){
			a = a%b;
			swap(a,b);
		}
		cout << a << " " << c << endl;
	}
	return 0;
}