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

int main(){
	int n,m,c,t;
	while(cin >> n >> m,n || m){
		c = 1;
		if(m > n) swap(n,m);
		while(n % m != 0){
			t = n % m;
			n = m;
			m = t;
			++c;
		}
		cout << m << " " << c << endl;
	}
	return 0;
}