#include<bits/stdc++.h>
using namespace std;
int main(){
	int x, y;
	while(1){
		int count=0, tmp;
		cin>>x>>y;
		if(x == 0 && y == 0) break;
		while(1){
			if(y == 0) break;
				x = x % y;
				tmp = x;
				x = y;
				y = tmp;
				count++;
		}
		cout<<x<<" "<<count<<endl;
	}
	return 0;
}

