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

